2012-11-24 30 views
5

我想用prduct但當上傳圖片,我看到錯誤jQuery的文件上傳語法錯誤:JSON.parse:後JSON數據意外非空白字符

語法錯誤: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/' 
}); 

圖片真實保存在服務器上,但錯誤與他出示上傳後。

第一步 http://s55.radikal.ru/i149/1211/10/8c8d911589de.jpg

第二步,錯誤 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 

請告訴我爲什麼我有這個錯誤?何時出錯?

+2

您顯示的「對請求的響應」不是有效的JSON,因爲在關閉']'之後的文本。如果您可以將PHP更改爲_not_,則會在關閉']後返回所有內容,您將擁有有效的JSON。 「意外的非空白字符」是在關閉']後的'/ home/m/etc'中的'/'。 – nnnnnn

+0

謝謝。很好的回答) – Loki

回答

3

由於關閉後的文本,您顯示的「對請求的響應」無效JSON]。

如果你可以改變你的PHP在關閉後不返回任何東西],你將擁有有效的JSON。

的 「意外非空白字符」 是/在/ home /米/等關閉後]

我刪除部分代碼時,寫入/家/米/ malishkaru /的public_html /功能/ blueimp- jQuery的文件上傳/服務器/ PHP和所有的工作。

付款人:謝謝nnnnnn

P.P.S .:答案僅供參考。用戶nnnnnn給出很好的答案。

+0

請問你刪除了哪部分? –

相關問題