0

I'm using jquery file upload and it keeps returning a data.result of undefined in my 'done' callback. For the server side I am using PHP Zend framework. How do I get results back from the server?

Every other browser works fine besides IE. I saw this question on IE issues (jquery file upload - IE done callback data.result issue), but I am not even getting anything back and I've tried the suggestions in the comments (setting response content type to text/html or text/plain).

This is my js code:

$('div.input-file.button_image input').fileupload({
    type: 'POST',        
    limitConcurrentUploads: 1
});

$('div.input-file.button_image input')
.bind('fileuploaddone', function (e, data) {
           if (data.result[0].body) {
                var html = data.result[0].body;
                result = {};
                result.thumbnail_url = "";
                result.rotate_url = "";
                result.delete_url = "";
            } else {
                JSON.parse(data.result);
            }         
}
Community
  • 1
  • 1
kailoon
  • 2,131
  • 1
  • 18
  • 33
  • can you share the link? – pvnarula Jun 10 '13 at 15:23
  • Unfortunately, no, sorry. internal dev environment. I can provide as much code snippets as necessary though. – kailoon Jun 10 '13 at 15:25
  • 2
    @pvnarula Code would be more appropriate, direct links to other sites to demonstrate a problem is usually frowned upon unless appropriately accompanied by code in the question. – Kevin B Jun 10 '13 at 15:25
  • 1
    First, lets see what `data` is in IE. `alert(typeof data)` this will both tell us if we're getting to the DONE, and it will tell us whether or not data is an object. – Kevin B Jun 10 '13 at 15:30
  • I set a breakpoint on IE developer tools in the done function callback which gets hit. The 'Locals' variable says data is an Object with data.result being undefined. – kailoon Jun 10 '13 at 15:32
  • 2
    Next, find a way to *"look"* at the iframe that is being generated by the request to inspect its contents. I'm not quite sure how to do that in IE. My guess is IE is incorrectly parsing the returned html page, resulting in loss of data. – Kevin B Jun 10 '13 at 15:35
  • 1
    Thank! This led me to see my error. Apparently it was hitting some error condition and that part was not returning 'text/html' which loses the response. You should apply an answer so I can mark it. – kailoon Jun 10 '13 at 15:54
  • hi, i am facing a similar issue. can you tell me how to inspect that iframe or how and where to check the response that is being parsed incorrectly. Is there any specific format that should be followed while sending response to IE? – Mandeep Jain Aug 06 '13 at 16:14

0 Answers0