IE9 syntax on jquery crossbrowser with jsonp and FF, Chrome
Posted
by
Andrew Walker
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Walker
Published on 2012-10-11T09:34:04Z
Indexed on
2012/10/11
9:36 UTC
Read the original article
Hit count: 510
I have the following code and i have a problem in ensuring part of it is used when a IE browser is used, and remove it when any other browser is used:
$.ajax({
url: 'http://mapit.mysociety.org/areas/'+ulo,
type: 'GET',
cache: false,
crossDomain: true,
dataType: 'jsonp',
success: function(response) {
This works fine in IE9 because I have put the dataType as jsonp. But this will not work on Chrome or FF. So I need to remove the dataType.
I tried this:
<!--[IF IE]> dataType: 'jsonp', <![endif]-->
But it did not work. It's worth noting, it does not need the dataType set when in FF or Chrome as it's json.
Whats the correct syntax to have this work ?
Thanks
Andrew
© Stack Overflow or respective owner