Sohrab
Sohrab

Reputation: 11

SyntaxError: Unexpected token <

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

Upvotes: 1

Views: 75

Answers (2)

Nino Filiu
Nino Filiu

Reputation: 18473

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.

Upvotes: 1

joernneumeyer
joernneumeyer

Reputation: 46

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.

Upvotes: 0

Related Questions