죄송합니다.이 게시물을 다시 게시 해 주셔서 감사하지만 며칠 동안 인터넷을 검색 한 후 stackoverflow 및 기타 여러 사이트를 살펴본 후에도이 문제를 해결하는 데는 더 가까이 다가 갈 수 없습니다. 나는 JavaScript에 올 때 막대한 멍청한 놈이다. 그리고 나는 이것에 끊임없이 붙어있는 것 같다.Uncaught SyntaxError : 예기치 않은 토큰 <jsUpload.js : 97 xhr.onload
다음 코드에 문제가있는 것 같습니다. 나는 오류가 계속 : catch되지 않은 구문 에러 :이 잘못 갈 곳 난 그냥 내 인생을 알아낼 수 없습니다에 대한 예기치 않은 토큰 < xhr.onload
function getFile(fileId){
log('Checking whether to resume upload');
var fileData = localStorage[fileId];
if (fileData){
var fileParts = fileData.split("|");
log ('Resuming upload from package '+(parseInt(fileParts[2])+1));
setDetails({
fileId:fileParts[0],
token:fileParts[1],
currentPackage:fileParts[2]
});
}else{
log ('No upload to resume, informing server to initialize a new upload');
// submit file information to server
var formData = new FormData();
formData.append('totalSize', self.totalSize);
formData.append('type', self.type);
formData.append('fileName', self.fileName);
//error lies from here on
var xhr = new XMLHttpRequest();
xhr.open('POST', self.url, true);
xhr.onload = function(e) {
var response = JSON.parse(xhr.responseText);
if (response.action=="new_upload"){
log ('New upload initialized with ID '+response.fileid+' and token '+response.token);
setDetails(setFile(fileId,response.fileid,response.token));
}
};
합니다. 적절한 방향으로 나를 가리키면 도움이 될 것입니다. 지금까지 나는 모든 < 문자를 삭제하려고 시도했지만 여전히 운이 없다. 나는 심지어 Jsonlint.com을 시도해 보았지만 그와 같은 행운은 없었습니다.
//managed to track the error dow to this through JSONlint:
{
responseText="<br><table border='1' c.../div></td></tr></table>",
mozResponseArrayBuffer=ArrayBuffer,
more...
}
//with the error output as:
Parse error on line 1:
{ responseText="<br><t
-----^
Expecting 'STRING', '}'
어디에 내가 잘못 했습니까?
이전 게시물을 편집하면 마지막 편집 시간과 함께 다시 '흥미로운'페이지로 이동합니다. 재 게시 할 필요가 없습니다! – 11684
이것은 게시물의 오타입니다 :'JSON.parse ('xhr.responseText');'? 'xhr.responseText'는 여기서 인용되지 않아야합니다. – Teemu
그게 내 잘못이야, 내 오타가 그거야. –