Question

I'm building a simple WebAPI 2 service based on the MVC model. I've created a simple front-end index.html page which has a button to invoke the getJSON call, passing a relative URI. If this succeeds it should display an alert box. On the local dev machine, everything works for both IE and Chrome. However, when I try accessing from another computer on the network, it stops working in IE, but still works ok in Chrome. All of my IE are version 11. Below is the getJson code snippet. I have tried many suggestions from other posts such as using .ajax instead with cache:false, crossDomain:true, and using jsonp instead.

In the IE that doesn't work, I tried manually type in the full address as that in the getJson call and it actually works. Therefore I'm guessing for some reason the .getJson call is not executing. Any help is greatly appreciated.

$.getJSON(uri + '/' + filepath)
    .done(function (data) {
        alert('test');
    })
    .fail(function (jqXHR, textStatus, err) {
        $('#product').text('Error: ' + err);
    });
Was it helpful?

Solution

Posting the answer just in case somebody else runs into it. In my case IE was loading a version of jquery that apparently causes "JSON undefined" error. Here is what I did to solve it:

<!--[if lt IE 9]>
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
    <script src="http://code.jquery.com/jquery-2.0.3.js"></script>
<!--<![endif]-->
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top