简体   繁体   中英

jQuery Load - Error: Uncaught SyntaxError: Unexpected token <

Error: Uncaught SyntaxError: Unexpected token <

I'm getting the above error when attempting a jquery load:

$('#footer').load(UrlOfFooterContent);

UrlOfFooterContent is the URL of an MVC controller action in a separate website in the same domain. It would seem that there is a problem dealing with the angle bracket but I don't know how to get around it in this situation.

Background

Our website is made up of a number of child websites that each refer to a shared header project. The header project pushes the header and footer content into empty DIVs in each child website that references it. The site I'm working on is a little different and doesn't need the header but it does need the footer.

Since the header project pushes the data and I'm not referencing the header, I therefore need the child website to pull the footer content from the header.

This was how it used to work with no problems, UrlOfFooterContent used to contain the URL of a text file containing the footer source - however someone changed the header project and now the footer source is only available from the controller action as described above.

Many thanks in advance Simon

It turns out the error 'Error: Uncaught SyntaxError: Unexpected token <' was a red herring - it's related to an internal network issue and will not be see externally.

The correct source was being loaded but there were css files missing also so it bore no resemblance to what I was expecting - all I saw was a mess and an error.

Thanks for your replies.

Oh, A. Wolff - in answer to your question.... check the other replies...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM