Title: json return data not working in IE or Chrome
Tags: php;json;uploadify
Question: I have problems returning JSON data after using Uploadify.  

This code works in Firefox, but not in IE 9 or Google Chrome.
This is the script script for Uploadify:

```     jQuery("#uploadify_gallery").uploadify({
        'queueID'        : 'fileQueue',
        'uploader'       : siteURL + '/wp-content/plugins/uploadify/uploadify.swf',
        'script'         : siteURL + '/wp-content/plugins/uploadify/uploadify_gallery.php',
        'fileExt'        : '*.jpg;*.jpeg;*.png',
        'auto'           : true,
        'multi'          : true,
        'method'         : 'POST',
        'buttonImg'      : siteURL + '/wp-content/themes/storelocator/img/buttons/img_upload_grey_bg.png',
        'cancelImg'      : siteURL + '/wp-content/plugins/uploadify/cancel.png',
        'queueSizeLimit' : 20,
        'scriptData'     : {'entity':jQuery('#entity').val(),'entity_id':jQuery('#entity_id').val()},
        'onComplete'     : function(event, queueID, fileObj, response, data) {

          alert('test'); // <-- THIS WORKS 

          //This makes the json response readable
          var result = eval("(" + response + ")");
          alert(result.toSource()); // <-- this never fires
        },
      });
```

This is the code I test with in ```uploadify_gallery.php```:

```$res = array('a' =&gt; 1, 'b' =&gt; 2, 'c' =&gt; 3, 'd' =&gt; 4, 'e' =&gt; 5);
echo json_encode($res);
```

It worked yesterday, and I've got it working on 

Any suggestions on how I can make this work?

Comment: Eval is bad. Avoid it at all costs.  Also, what does the JSON that the server is returning to your script look like?

Here is the accepted answer: Inspect the value returned by the server and verify that it is valid JSON (using JSONLint for example). 

After that you can use ```jQuery.parseJSON()``` to convert the response string into an object.

Comment for this answer: Yes, I discovered this and that's what I'm using now. Thanks :)

Here is another answer: eval(); isn't a good choice, it's considered pretty bad, since it won't work in Internet Explorer, at least the older ones. Check this out

How can I get this eval() call to work in IE?

http://24ways.org/2005/dont-be-eval

You'll get the response as a json object, so instead of eval, just loop through it with an each

```$(response).each(function(index, value) {
    console.log(value);
});
```

For more information on each, check out http://api.jquery.com/each/


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:02/01/12', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<php><json><uploadify>', 'Title': 'json return data not working in IE or Chrome', 'ViewCount': 449, 'id': 9094106, 'user_AboutMe': '<p>I\'m an interaction designer with focus on usability and front-end design.\n10+ years of PHP programming and 6+ years of WordPress experience.</p>\n\n<p>"Hardcore" programming is not my strong side as I tend to focus on usability, design and consultancy.</p>\n', 'user_AccountId': 32899.0, 'user_DisplayName': 'Steven', 'user_Reputation': 18906.0, 'user_Views': 1689.0, 'user_id': 91612.0}}