Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var upload = function(files) {
  2. var formData = new FormData(),
  3. xhr = new XMLHttpRequest(),
  4. x = 0;
  5.  
  6. for(x = 0; x < files.length; x++) {
  7. formData.append('file[]', files[x]);
  8. }
  9. console.log(x);
  10.  
  11. xhr.onload = function() {
  12. var data = JSON.parse(this.responseText);
  13. displayUploads(data);
  14. };
  15.  
  16. xhr.open('post', 'upload.php');
  17. xhr.send(formData);
  18. };
  19.  
  20. Uncaught SyntaxError: Unexpected token < in JSON at position 0
  21. at JSON.parse (<anonymous>)
  22. at XMLHttpRequest.xhr.onload (строка 55, там где x = 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement