Javascript 未捕获的语法错误:缺少)参数列表后-其他答案无法解决此问题
我的SO搜索告诉我,当您有额外的括号或其他格式错误时,会发生此错误。。但是我已经一次又一次地检查了我的代码片段,并没有发现任何这样的问题。但我仍然得到了错误:Javascript 未捕获的语法错误:缺少)参数列表后-其他答案无法解决此问题,javascript,jquery,Javascript,Jquery,我的SO搜索告诉我,当您有额外的括号或其他格式错误时,会发生此错误。。但是我已经一次又一次地检查了我的代码片段,并没有发现任何这样的问题。但我仍然得到了错误: Uncaught SyntaxError: missing ) after argument list 下面是我的脚本。问题是我为什么会出现这个错误,以及如何解决这个问题 <?php $(document).ready(function() { alert("scripts.js detected");//check
Uncaught SyntaxError: missing ) after argument list
下面是我的脚本。问题是我为什么会出现这个错误,以及如何解决这个问题
<?php
$(document).ready(function() {
alert("scripts.js detected");//check
alert($("input#theInput").val());//check
/*
*
*/
$("form#theInputForm").submit(function(event) {
event.preventDefault();
if ($("input#theInput").val() == '') {
alert("Please enter a the value.");
} else {
$(".inputFormWrapper").css("height") = "10vh";
$(".otherSectionWrapper").show();
var theEntered = $("input#theInput").val();
$.ajax(
url: "get_the_data_two.php",
method: "get",
data: {
theFromUser: theEntered
},
success: function(otherData, textStatus, jqXHR) {
alert(otherData);//check
},
error: function(jqXHR, textStatus, errorThrown) {
alert("textStatus: " + textStatus + " \nerrorThrown: " + errorThrown);//check
}
);
}
});
});
?>
两件事:高度分配不正确和ajax语法 您的else部分应如下所示:
{
$(".inputFormWrapper").css("height","100px");
$(".responseSectionWrapper").css("height","90px");
var tmsiEntered = $("input#tmsiInput").val();
$.ajax({
url: "get_auth_data_two.php",
method: "get",
data: {
tmsiFromUser: tmsiEntered
},
success: function(responseData, textStatus, jqXHR) {
alert(responseData);//check
},
error: function(jqXHR, textStatus, errorThrown) {
alert("textStatus: " + textStatus + " \nerrorThrown: " + errorThrown);//check
}
});
}
如果有疑问,请检查参数列表中我错过的回调函数中的API:
例如:
function one(arg,callback){
alert("hay $(arg)");
callback();
}
one('avinash'function(){ //one('avinash',function(){ if ',' missing will get error
alert("after execution");
});
使用jslintAjax对象查找缺少的检查错误{缺少像这样的更改$.ajax{将对象传递给$.ajax{…}$.inputFormWrapper.csheight=10vh;是错误的赋值