JS error Uncaught SyntaxError: Unexpected token (analysis and solution)

Source: Internet
Author: User

JS error Uncaught SyntaxError: Unexpected token (analysis and solution)

JS error Uncaught SyntaxError: Unexpected token <Analysis and Solution

 

We usually encounter the following problems:

Uncaught ReferenceError: xxx is not defined

Uncaught TypeError: Cannot read property 'length' of undefined

Uncaught SyntaxError: Unexpected token ILLEGAL

However, the problem I encountered this time is: Uncaught SyntaxError: Unexpected token <

An endless loop may even occur, causing the browser to crash:

Because the debugging function of the browser cannot be used to locate the actual error location, you can only search by adding or deleting code in the binary method,

Finally, we found that the cause of the error was caused by the "eval" method, for example:

Because the address of the AJAX request must be accessed only after logon, the logon page will be displayed if you do not log on. Therefore, the HTML code of the logon page is returned, which leads to an error in executing the "eval" function;

 

 

Related Article

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.