'No Transport' Error w/ jQuery ajax call in IE
2015-12-22 16:23
751 查看
I need to use foursquare API to search venues. Of course it is cross-domain.
It has no any problems in Firefox but in Internet Explorer (7, 8, 9 I've tested).
My javascript code looks like:
In Firefox, it perfectly displays received data. In Internet Explorer, it logs on console:
What should I do?
Thanks in advance.
tested this on Windows Mobile 7.
After LOTS of time spent to understand, I finally found this:
http://bugs.jquery.com/ticket/10660
The Solution is simple, just set this:
and Ajax cross domain requests will work!
It has no any problems in Firefox but in Internet Explorer (7, 8, 9 I've tested).
My javascript code looks like:
searchVenues: function(searchQuery) { $.ajax({ url: 'https://api.foursquare.com/v2/venues/search', data: { sw: bound_south_west, ne: bound_north_east, query: searchQuery.query, oauth_token: FSQ_OAUTH_TOKEN, limit: 25, intent: 'browse', v: 20120206 }, cache: false, dataType: 'json', success: function(data) { displayResults(data, searchQuery.query); }, error: function(xhr, status, errorThrown) { console.log(errorThrown+'\n'+status+'\n'+xhr.statusText); } }); }
In Firefox, it perfectly displays received data. In Internet Explorer, it logs on console:
No Transport Error Error
What should I do?
Thanks in advance.
tested this on Windows Mobile 7.
After LOTS of time spent to understand, I finally found this:
http://bugs.jquery.com/ticket/10660
The Solution is simple, just set this:
$.support.cors = true;
and Ajax cross domain requests will work!
相关文章推荐
- 你不需要jQuery(三):新AJAX方法fetch()
- jquery1.9 下检测浏览器类型和版本的方法
- 你不需要jQuery(四)
- jquery serialize序列化中文乱码问题
- JQuery textarea中val(),text()
- jQuery Ajax 实例 ($.ajax、$.post、$.get)
- jQuery学习笔记_选择器
- jquery 插件
- JQuery Datatables服务器端处理示例
- JQuery的链式操作
- Javascript、Jquery获取浏览器和屏幕各种高度宽度
- JQuery的animate中callback函数的使用
- Jquery关于ajax中无法在success中获取返回值的问题
- jquery的table每列得到ID,jquery组装table
- jquery 去空格的应用
- selenium webdriver 学习总结-JQuery Selectors(十)
- 0顶 jQuery同步Ajax带来的UI线程阻塞问题及...
- jQuery学习笔记(二)基础事件
- 你不需要jQuery(五)
- data-ajax