IE9 syntax on jquery crossbrowser with jsonp and FF, Chrome
- by Andrew Walker
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