SyntaxError: Unexpected token <

Asked by At

I have a SyntaxError in jquery.validate.min.js File

How I can solve it?

SyntaxError: Unexpected token < /ajax.aspnetcdn.com/ajax/jquery.validate/1.15.0/jquery.validate.min.js:1

2 Answers

0
Community On

Most of the time, the error SyntaxError: Unexpected token < is caused if the src of a script tag refers to file which was not found.

So, I recommend you to check the url of the script's src for validity.

1
Nino Filiu On

The error is likely to mean that a .js file was fetched but an HTML was returned, probably because of an error 404 or similar. If you'd inspect the file that was fetched in the console (eg: in Chrome or Firefox, F12, then go to the network tab, then click on jquery.validate.min.js), you'll see some HTML content instead of the script for jquery.validate.min.js. Additionally that'd display the HTML of the error message from the server (404 page not found, 403 forbidden, etc).

You should check your connexion, check that your page has the sufficient authorizations to load content from ajax.aspnetcdn.com, and use https://ajax.aspnetcdn.com/... instead of /ajax.aspnetcdn.com/... in your script tag.