Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. xhr.onreadystatechange = function(e) {
  2. if ( 4 == this.readyState && 200 == this.status ) {
  3. // PHP returns "result~~<File Uploaded OK>~~n"
  4. response = xhr.responseText.split(">~~n");
  5. var xhrData = {};
  6. for(j=0;j<response.length-1;j++) {
  7. splt = response[j].split("~~<");
  8. key = splt[0];
  9. data = splt[1];
  10. xhrData[key] = data;
  11. }
  12. for(key in xhrData) {
  13. console.log("Key: "+key+"nData: "+xhrData[key]);
  14. //Key: result
  15. //Data: File Uploaded OK
  16. }
  17. console.log(xhrData.result); //undefined
  18. console.log(xhrData['result']); //undefined
  19. }
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement