Friday 5 September 2014

ajax error syntaxerror json parse unexpected token Jsonresult

I want Load Subcategories based on selected category using JQuery Ajax or JSON , on asp.net MVC application. 

Problem:
I've upgraded to VS.NET 2013, and now, every time I receive error when getting subcategories for category .

Error:jqXHR: 200textStatus: parser errorerror Thrown: SyntaxError: Unexpected token 


some solutions on internet was changing dataType:json or remove dataType and removing the content Type .. ,  i tried every possible solution with no luck.


after 4 hours of trying to solve the problem .i created on page with 2 dropdownlists only without master page, when i open HTML source code i found this line of code.


<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Chrome","requestId":"ac71e2a7594e4504a5135609483e8c7a"}
</script>
<script type="text/javascript" src="http://localhost:8157/eb9f5c3c339d488fb419a027dfa861bd/browserLink" async="async"></script>
<!-- End Browser Link -->



This is script is interfering with JQuery  library  and it crashes the jQuery reference.

this code came from new feature in visual studio 2013 called  Browser Link
After i disabled it the error went and every thing work as expected.





to disable it:




















No comments:

Post a Comment