-2

my below ajax code not work in ie 7,8 or 9,

for ie data not display, how to fix it?

<script type="text/javascript">
 $(document).ready(function () {
    $.ajax({
        url: "http://www.wideawakemarketing.com/sbt-post/",
        data: {},
        dataType: 'json',
        success: function (data) {
            alert(data);
        }
    });
});
</script>
Wiram Rathod
  • 1,895
  • 1
  • 19
  • 41
  • 1
    What does "not work" mean in your use case? What do you expect to happen that's not happening exactly? – Richard Neil Ilagan Jun 14 '13 at 12:17
  • your breaking the same domain policy (http://en.wikipedia.org/wiki/Same_origin_policy) – Liam Jun 14 '13 at 12:18
  • 4
    -1. Not enough info. jQuery ajax works perfectly well in IE 7/8/9 (assuming you're using jQuery v1.x and not v2.x). What errors are you getting? Have you checked the console? Do you know what line it is failing on? Why not? Does it work in other browsers? etc etc etc. You need to give a *lot* more detail. – Spudley Jun 14 '13 at 12:19
  • Try to use cache: false, maybe. And check data returned, if any – A. Wolff Jun 14 '13 at 12:19
  • The `document.write(element.title);` pretty much wipes the document, is that desired? – Mark Schultheiss Jun 14 '13 at 12:21
  • In IE, hit that F-12 key, look at that console and relay any errors it provides and add any other additional information you can provide (like what "data" returns - exactly etc.) otherwise, this is unanswerable in its current form. Does this work in Chrome or Fox for instance? – Mark Schultheiss Jun 14 '13 at 12:47

1 Answers1

-1

As comments have mentioned, you cannot make an AJAX call to another domain without it supporting JSONP. See What is JSONP all about? for more information

I'd also like to mention a change, as of jQuery 2.0 which is that it no longer supports IE 6, 7 & 8. So if you're using the new 2.x version of jQuery, you'll most likely run in to issues with various things being "broken" when trying them in the older versions of IE.

Community
  • 1
  • 1
Brad Christie
  • 100,477
  • 16
  • 156
  • 200
  • People downvoting and blatantly annoying the orange popup are becoming common practice on here these days I guess. @downvoter: what gives? – Brad Christie Jun 14 '13 at 12:34