發(fā)文章
發(fā)文工具
撰寫(xiě)
網(wǎng)文摘手
文檔
視頻
思維導(dǎo)圖
隨筆
相冊(cè)
原創(chuàng)同步助手
其他工具
圖片轉(zhuǎn)文字
文件清理
AI助手
留言交流
This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.
Hi everyone. We all know the role of ajax and its implementation. We can use ajax in asp.net as well as in javascript/jquery. But there is a limitation of same origin policy. i.e. we can only use ajax to post and get requests within our site. We can call webservices but that is from the code behind only. Even if we use any scripting language it restricts us calling a third party domain. Also over SSL javascript/jquery's ajax call gives up easily. But using jsonp with jquery's ajax api call we can target the ajax call outside the scope of our website.$(document).ready(function() { var surl = "http://www./webservice.asmx"; $.ajax({ type: 'GET', url: surl, crossDomain: true, contentType: "application/json; charset=utf-8", data: { UserID: 1234 }, dataType: "jsonp", success: function(msg) { $.each(msg, function(name, value) { alert(value); }); }, error: function(xhr, status, error) { alert('Servidor de error 404 !!'); }, async: false, cache: false }); });Note:- This will only work with json data type, so while requesting a web service should return the data in Javascript Object notation format.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
來(lái)自: gogo8848 > 《MVC》
0條評(píng)論
發(fā)表
請(qǐng)遵守用戶 評(píng)論公約
jquery ajax請(qǐng)求 發(fā)生canceled狀態(tài)時(shí)的處理
其實(shí)jquery發(fā)起一個(gè)ajax請(qǐng)求后會(huì)返回一個(gè)jqXHR對(duì)象,你隨后可對(duì)該對(duì)象進(jìn)行操作,包括abort中斷操作。var jqXhr = $.ajax({ url: ''some ajax url'', success: f...
Jquery+Ajax按鈕點(diǎn)擊顯示等待圖片
2.注意div的id, 圖像地址和jquery地址。
ASP.NET MVC中使用AJAX(XMLHttpRequest、Microsoft A...
ASP.NET MVC中使用AJAX(XMLHttpRequest、Microsoft A...AJAX技術(shù)是純客戶端技術(shù),任何客戶端框架(如:Microsoft AJAX Library,Prototype,J...
傳智播客.Net培訓(xùn).net視頻教程
傳智播客.Net培訓(xùn).net視頻教程。課程說(shuō)明 企業(yè)面試、筆試的時(shí)候在.Net高級(jí)技術(shù)上的考查力度比ASP.Net、AJAX、JQuery之類的具體技術(shù)方面的力度更大,比如幾乎每個(gè)招聘企業(yè)都會(huì)考查委托與事件、多態(tài)、設(shè)...
.net技術(shù)整理
ASP.NET性能優(yōu)化 使用ASP.NET進(jìn)行開(kāi)發(fā),了解一下ASP.NET的性能優(yōu)化也是不錯(cuò)的,當(dāng)然也有其他很好的資源,期待大家的分享。參見(jiàn)博客:《靈動(dòng)思緒EF(Entity FrameWork) 》 參見(jiàn)博客:《ADO.NET Entity Fr...
應(yīng)用最廣的十大Javascript框架
應(yīng)用最廣的十大Javascript框架應(yīng)用最廣的十大Javascript框架2009.02.20 來(lái)自:CSDN 共有評(píng)論()條發(fā)表評(píng)論 收藏【CSDN 2月20日消...
ASP.NET MVC4 IN ACTION學(xué)習(xí)筆記
ASP.NET MVC4 IN ACTION學(xué)習(xí)筆記。8: <a data-ajax="true" data-ajax-method="GET" data-ajax-mode="repl...
ASP.NET服務(wù)器控件開(kāi)發(fā)(5)
ASP.NET服務(wù)器控件開(kāi)發(fā)(5)如果在服務(wù)器控件中添加客戶端功能,將會(huì)創(chuàng)作出功能更強(qiáng)大,界面更豐富的服務(wù)器控件。ASP.NET脫離了這一范疇并使服務(wù)器控件能夠發(fā)出客戶端腳本,從而使服務(wù)器控件能夠?qū)⒖蛻?..
本周ASP.NET英文技術(shù)文章推薦[07/29 - 08/04]
1. .NET 3.5和VS 2008中的ASP.NET AJAX 2. 將應(yīng)用ASP.NET AJAX 1.0的Web站點(diǎn)和Web應(yīng)用程序升級(jí)到.NET Framework 3.5 3. 8月2號(hào)...
微信掃碼,在手機(jī)上查看選中內(nèi)容