bug:SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data. $("#file-5").fileinput({ language: 'zh', //設定語言 uploadUrl: "{:U('profile/upload')}", // avatar_uploadyou must set a valid URL here else you will get an error __UPLOAD__partner/img allowedFileExtensions : ['jpg', 'png','gif'], overwriteInitial: false, maxFileSize: 1000, maxFilesNum: 1, //allowedFileTypes: ['image', 'video', 'flash'], slugCallback: function(filename) { alert("aaa"); return filename.replace('(', '_').replace(']', '_'); } }) .on("fileuploaded", function (e, data) { var res = data.response; if (res.state > 0) { alert('上傳成功'); alert(res.path); } else { alert('上傳失敗') } }); 背景程式我有public function upload(){ }方法,是php的
出錯的,看著似乎是語法錯誤,我懷疑是前台fileinput的事件那裡出錯了,因為後台我只返回一個值做測試,應該沒問題的,對fileinput不熟,求助啊!!!誰有例子提供給我參考下也好,謝謝!
回複內容:
bug:SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data. $("#file-5").fileinput({ language: 'zh', //設定語言 uploadUrl: "{:U('profile/upload')}", // avatar_uploadyou must set a valid URL here else you will get an error __UPLOAD__partner/img allowedFileExtensions : ['jpg', 'png','gif'], overwriteInitial: false, maxFileSize: 1000, maxFilesNum: 1, //allowedFileTypes: ['image', 'video', 'flash'], slugCallback: function(filename) { alert("aaa"); return filename.replace('(', '_').replace(']', '_'); } }) .on("fileuploaded", function (e, data) { var res = data.response; if (res.state > 0) { alert('上傳成功'); alert(res.path); } else { alert('上傳失敗') } }); 背景程式我有public function upload(){ }方法,是php的
出錯的,看著似乎是語法錯誤,我懷疑是前台fileinput的事件那裡出錯了,因為後台我只返回一個值做測試,應該沒問題的,對fileinput不熟,求助啊!!!誰有例子提供給我參考下也好,謝謝!