Uncaught syntaxerror:missing) After argument list error resolution

Source: Internet
Author: User

The first one weeks of casual play, in the JSP <a onclick= "Click (Parameters 1, Parameters 2, Parameters 3)" > hyperlink </a> pass parameter request Ajax when the uncaught syntaxerror: Missing after argument list this error, go to the Internet to inquire about this error, found is lost), caused the problem, but how to check the parentheses are not missing, the code is as follows:

<a target= "_blank" onclick= "click" (<%=user.id%>,<%=user.name%>,<%=user.number%>) "class=" Blue "> View </a> <!--via Ajax request to UserQuery query class--> <script type=" Text/javascript "> function Click (id,name,n umber) {$.ajax ({type: "post", url: "/student/userinfo/userquery.htm?id=" + Escape (ID) + " ;" +escape (name) + "&" +escape (number), data:{"id": ID, "name": Name, "number": Number}, DataType:  
            ' Text ', Success:successmsg, error:errormsg}) function errormsg () {
            $ ("Div.dialog"). Show ();
        $ ("#info"). HTML ("Error querying user Information");
                function Successmsg (msg) {if (msg = = "SUCCESS") {$ ("Div.dialog"). Show ();
            $ ("#info"). HTML ("query succeeded");
                else {$ (' Div.dialog '). Show ();
            $ ("#info"). HTML ("Query failed"); }} </script>

Click to see the hyperlink when you will report uncaught syntaxerror:missing) After argument list this error, after viewing if only with one parameter <%=user.id%> for int type will not have this problem, When three parameters are passed, the code must be modified when there are parameters that are not of type int, and the code is modified as follows:

<a target= "_blank" onclick= "click" (' <%=user.id%> ', ' <%=user.name%> ', ' <%=user.number%> ') class = "Blue" > View </a>

The Ajax request method does not need to change, so that will not report this error, JS often reported some errors, so you need to carefully check the code, such as to see whether the data transmission when the format is problematic, without a semicolon, the data is less, less parentheses and so on.

The above content is for reference only, thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.