一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

Jquery Cross

 gogo8848 2014-08-11

Jquery Cross-Domain ajax call using JSONP

, 11 Oct 2013
   5.00 (1 vote)
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

Editorial Note

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ASP.NET Community

United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.
 
The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

247 members


    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多

    日韩无套内射免费精品| 爱草草在线观看免费视频| 国产精品激情在线观看| 亚洲一区二区三区福利视频| 日韩美女偷拍视频久久| 日韩精品免费一区三区| 99福利一区二区视频| 日本久久精品在线观看| 丝袜视频日本成人午夜视频| av在线免费观看一区二区三区 | 日韩人妻免费视频一专区| 人妻露脸一区二区三区| 在线观看免费无遮挡大尺度视频 | 97人摸人人澡人人人超碰| 国产91麻豆精品成人区| 欧美国产精品区一区二区三区| 欧美日韩国产亚洲三级理论片| 在线观看视频日韩精品| 国产一区在线免费国产一区| 婷婷开心五月亚洲综合| 69精品一区二区蜜桃视频| 黄片免费在线观看日韩| 男人的天堂的视频东京热| 国产盗摄精品一区二区视频| 免费在线成人午夜视频| 国产日韩久久精品一区| 欧美野外在线刺激在线观看| 亚洲高清欧美中文字幕| 好吊色免费在线观看视频| 欧美区一区二在线播放| 欧美日韩国产免费看黄片| 激情亚洲内射一区二区三区| 高清一区二区三区四区五区| 午夜国产成人福利视频| 久久天堂夜夜一本婷婷| 亚洲中文字幕乱码亚洲| 欧美日韩亚洲精品在线观看| 免费在线成人午夜视频 | 色哟哟哟在线观看视频| 超碰在线播放国产精品| 国产无摭挡又爽又色又刺激|