5

我想使用产品,但上传图片时出现错误

SyntaxError:JSON.parse:JSON 数据后出现意外的非空白字符

script directory: Folder2
directory Jquery-file-upload: function/blueimp-jQuery-File-Upload/
in main.js i edit rows

$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: 'server/php/'
});

$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: '../function/blueimp-jQuery-File-Upload/server/php/'
});

图片真实保存在服务器上,但上传后显示错误。

Step1 http://s55.radikal.ru/i149/1211/10/8c8d911589de.jpg

Step2 出现错误 http://s019.radikal.ru/i604/1211/8c/7e05d92b30ef.jpg

furebug 对请求的响应

[{"name":"1353755388.jpg","size":879394,"type":"image\/jpeg","url":"http:\/\/malish-ka.ru\/function\/blueimp-jQuery-File-Upload\/server\/php\/files\/1353755388.jpg","thumbnail_url":"http:\/\/malish-ka.ru\/function\/blueimp-jQuery-File-Upload\/server\/php\/files\/thumbnail\/1353755388.jpg","upload_to_db":true,"delete_url":"http:\/\/malish-ka.ru\/function\/blueimp-jQuery-File-Upload\/server\/php\/?file=ExPRoG-1353755388.jpg","delete_type":"DELETE"}]/home/m/malishkaru/public_html/function/blueimp-jQuery-File-Upload/server/php

请告诉我为什么我有这个错误?什么时候出错?

4

1 回答 1

3

由于结束 ] 之后的文本,您显示的“对请求的响应”不是有效的 JSON。

如果您可以将 PHP 更改为在关闭 ] 后不返回所有内容,您将获得有效的 JSON。

“意外的非空白字符”是 /home/m/etc 中的 / 结束后]

我在写/home/m/malishkaru/public_html/function/blueimp-jQuery-File-Upload/server/php时删除了部分代码并且一切正常。

PS:谢谢nnnnnn

PPS:只回答关闭的问题。用户nnnnnn给出了很好的答案。

于 2012-11-24T20:16:37.037 回答