Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xhr.onreadystatechange = function(e) {
- if ( 4 == this.readyState && 200 == this.status ) {
- // PHP returns "result~~<File Uploaded OK>~~n"
- response = xhr.responseText.split(">~~n");
- var xhrData = {};
- for(j=0;j<response.length-1;j++) {
- splt = response[j].split("~~<");
- key = splt[0];
- data = splt[1];
- xhrData[key] = data;
- }
- for(key in xhrData) {
- console.log("Key: "+key+"nData: "+xhrData[key]);
- //Key: result
- //Data: File Uploaded OK
- }
- console.log(xhrData.result); //undefined
- console.log(xhrData['result']); //undefined
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement