$.getJson not working in IE

前端 未结 3 683
迷失自我
迷失自我 2021-01-18 04:48

Ok, for some reason my getJson is not working. I am pulling some stock information and it works in all major browsers except IE.

I have created a JSfiddle here: htt

相关标签:
3条回答
  • 2021-01-18 05:31

    Technically, I think you're violating the Same Origin Policy on this one. By definition, you can't do a JSON get from a domain other than your own....and getting data from Yahoo is certainly a different server than jsFiddle's. There is a similar issue reported here. The CORS exceptions they list are IE up to version 10, which would explain the issue perfectly.

    The problem could be solved by using a "?" in your callback handler. See this stack article for more info.

    0 讨论(0)
  • 2021-01-18 05:34

    Since its a old post this answer may be helpful to other seekers.

    There may be two reasons why getJson not working in IE.

    1.Either Jsonp requests which resolved by adding

     &callback=? or &callback=?
    

    2.Set ajax catch.

    $.ajaxSetup({ cache: false });
    

    If still you have problem, it may be because of the cross-platform API usage.

    0 讨论(0)
  • 2021-01-18 05:46

    I'll go for the well known cross domain policy issue with jquery and IE.

    This article explain well the solution:

    http://cypressnorth.com/programming/cross-domain-ajax-request-with-json-response-for-iefirefoxchrome-safari-jquery/

    0 讨论(0)
提交回复
热议问题