gpt4 book ai didi

javascript - 语法错误 : missing ; before statement getting this error in jquery

转载 作者:行者123 更新时间:2023-11-30 06:53:43 25 4
gpt4 key购买 nike

    PhoneGap.exec = function(success, fail, service, action, args) {
try {
var callbackId = service + PhoneGap.callbackId++;
if (success || fail) {
PhoneGap.callbacks[callbackId] = {success:success, fail:fail};
}

var r = prompt(JSON.stringify(args), "gap:"+JSON.stringify([service, action, callbackId, true]));
console.log(r)
// If a result was returned
if (r.length > 0) {
eval("var v="+r+";");

// If status is OK, then return value back to caller
if (v.status === PhoneGap.callbackStatus.OK) {

// If there is a success callback, then call it now with
// returned value
if (success) {
try {
success(v.message);
} catch (e) {
console.log("Error in success callback: " + callbackId + " = " + e);
}

// Clear callback if not expecting any more results
if (!v.keepCallback) {
delete PhoneGap.callbacks[callbackId];
}
}
return v.message;
}

// If no result
else if (v.status === PhoneGap.callbackStatus.NO_RESULT) {

// Clear callback if not expecting any more results
if (!v.keepCallback) {
delete PhoneGap.callbacks[callbackId];
}
}

// If error, then display error
else {
console.log("Error: Status="+v.status+" Message="+v.message);

// If there is a fail callback, then call it now with returned value
if (fail) {
try {
fail(v.message);
}
catch (e1) {
console.log("Error in error callback: "+callbackId+" = "+e1);
}

// Clear callback if not expecting any more results
if (!v.keepCallback) {
delete PhoneGap.callbacks[callbackId];
}
}
return null;
}
}
} catch (e2) {
console.log(e2);
}
};

我正在使用这个函数并在 eval("var v="+r+";");我收到“SyntaxError: missing ; before statement”这个错误。这是一个用于提取 zip 文件的 phonegap 插件。请让我知道我哪里错了。

最佳答案

尝试使用:

eval("var v="+r);

或者只是:

var v = r;

关于javascript - 语法错误 : missing ; before statement getting this error in jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22344168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com