我正在使用我在网上找到的这个脚本作为测试,但我不断收到这个非法令牌错误。
$(document).ready( function() {
done();
});
function done() {
setTimeout( function() {
updates();
done();
}, 200);
}
function updates() {
$.getJSON(“fetch.php”, function(data) {
$(“ul”).empty();
$.each(data.result, function(){
$(“ul”).append(“Name: “+this['name']+”Age: “+this['age']+”Company: “+this['company']+”");
});
});
}
另外,我将如何使其工作? $("ul").append("
代码中到处都是"花哨的卷曲"引号“”
而不是纯引号""
$.getJSON(“fetch.php”, function(data) {
^^^ ^^^
应该看起来像
$.getJSON("fetch.php", function(data) {
^^^ ^^^
认为可以是",将 ir 更改为 "。
@epascarello是正确的。 jQuery不接受这种类型的引号(例如“ul”
)。请记住,您只能使用单引号''
或双引号""
。