javascript 语法错误:丢失:在属性 id 之后
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20118034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SyntaxError: missing : after property id
提问by Xavi
It shows Syntax Error: missing : after property id near '<img src="loading.gif" />'
;`
它显示语法错误:丢失:在附近的属性 id 之后'<img src="loading.gif" />'
;`
<script>
$(document).ready(function() {
$("#client").on("change", function() {
var clientid=$("#client").val();
$.blockUI(
{
'<img src="loading.gif" />';
timeout: 5000
});
$.ajax({
type:"post",
url:"clientnetworkpricelist/yourfile.php",
data:"title="+clientid,
success:function(data){
$('.blockUI').hide();
$("#result").html(data);
}
});
});
});
</script>
回答by Curt
Change blockUI
script to:
将blockUI
脚本更改为:
$.blockUI({
message: '<img src="loading.gif" />',
timeout: 5000
});
回答by BenM
Property values of an object need to separated by commas, not semicolons. Your code should be:
对象的属性值需要用逗号分隔,而不是分号。你的代码应该是:
message: '<img src="loading.gif" />',
timeout: 5000
For example, your blockUI()
function should be called as follows:
例如,您的blockUI()
函数应按如下方式调用:
$.blockUI({
message: '<img src="loading.gif" />',
timeout: 5000
});