У меня проблемы с возвратом данных JSON после использования Uploadify.json возвращает данные, не работающие в IE или Chrome
Этот код работает в Firefox, но не в IE 9 или Google Chrome.
Это скрипт скрипт для 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
},
});
Это код, который я проверить с в uploadify_gallery.php
:
$res = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode($res);
Он работал вчера, и я получил это работает на
Любые предложения о том, как я могу это сделать?
Eval is bad. Избегайте его любой ценой. Кроме того, как выглядит JSON, возвращаемый сервером на ваш скрипт? – GordonM