【发布时间】:2017-06-05 08:02:38
【问题描述】:
我的 SO 搜索告诉我,当您有一个额外的括号或另一个格式错误(source、source 等)时会发生此错误。但是我一遍又一遍地检查我的代码 sn-p ,并且无法发现任何此类问题。但我仍然收到错误:
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
}
);
}
});
});
?>
【问题讨论】:
-
寻找丢失的
) -
使用 jslint 检查
-
Ajax 对象错误
{缺少像这样的更改$.ajax({ -
将
Object传递给$.ajax({ ... }) -
$(".inputFormWrapper").css("height") = "10vh";是一个错误的分配
标签: javascript jquery