Tag: web services

使用jQuery jsonp跨域调用ASP.NET Web服务

我的问题是已知的问题,在这里和这里讨论。 但即使在阅读并实施建议的解决方案后,我也无法完成这项工作。 问题 :返回xson的xml的web服务: “Now i am getting jsop string””2nd param” 现在让我们将代码分成几部分: 远程服务器(IIS 7.0,.NET 4): web.config中: 网络服务: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Script.Services; using JsonHttpModule; /// /// Summary description for JSONP_EndPoint /// [WebService(Namespace = “http://tempuri.org/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, […]

如何从jQuery调用WCF Web服务?

如何从jquery调用wcf服务(我正在使用asp.net mvc)。 这就是我以前用asmx webservices做的事情: $.ajax({ type: “POST”, url: “Services/MyService.asmx/DoSomething”, data: “{}”, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function(msg) { //do the magic } }); 如何使用WCF服务执行相同操作?

JqG​​rid addJSONData + ASP.NET 2.0 WS

我有点迷茫。 我试图实现基于JqGrid的解决方案,并尝试使用函数作为数据类型。 我已经通过这本书设置了所有,我调用了WS并获得了JSON,我在ajax调用中的客户端获得了成功,并且我使用addJSONData “绑定” addJSONData但是网格仍为空。 我现在没有任何线索…同一页面上的其他“本地”样本没有问题(jsonstring …) 我的WS方法如下: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string GetGridData() { // Load a list InitSessionVariables(); SA.DB.DenarnaEnota.DenarnaEnotaDB db = new SAOP.SA.DB.DenarnaEnota.DenarnaEnotaDB(); DataSet ds = db.GetLookupForDenarnaEnota(SAOP.FW.DB.RecordStatus.All); // Turn into HTML friendly format GetGridData summaryList = new GetGridData(); summaryList.page = “1”; summaryList.total = “10”; summaryList.records = “160”; int i = 0; foreach […]

如何使用jquery ajax调用传递webservice的凭据?

我正在使用这样的jquery ajax调用: $.ajax({ url: WEBSERVICE_URL, type: “GET”, dataType: “application/json; charset=utf-8”, username: “admin”, // Most SAP web services require credentials password: “admin”, processData: false, contentType: “application/json”, success: function() { alert(“success”); }, error: function() { alert(“ERROR”); }, }); 仍然是电话不会去网络服务。 每次我收到ERROR警报。 有人可以帮我这个吗?

在Webservice ajax调用中的Modal Popup Extender中显示加载图像

我使用.ajax来调用webservice方法,该方法向输入的电子邮件发送电子邮件。 我想展示一个ajax模态弹出扩展器,其中包含一个图片,上面写着’sendig …’ 我使用.ajax来调用我的webservice: var SendingModal = $find(‘SendMPE’); var Resend = -1; $.ajax({ async: false, type: “POST”, url: “FinKaynWebService.asmx/SendEmail”, data: “{‘Email’: ‘” + Email + “‘}”, contentType: “application/json; charset=utf-8”, dataType: “json”, beforeSend: function() { $(“#SendMPE”).show(); }, success: function(response) { Resend = response.d; SendingModal.hide(); }, failure: function(msg) { alert(‘Sending Email failed,try later’); } }); 问题是我的SendMPE没有显示。 Sending… […]

在jqgrid中实现删除和编辑操作

我有以下JQgrid实现 colModel: [ { name: ‘NameEn’, index: ‘NameEn’, width: 100, align: ‘left’ }, { name: ‘Desc’, index: ‘Desc’, width: 100, align: ‘left’ }, { name: ‘ID’, index: ‘ID’, width: 100, align: ‘left’, hidden:true } ], caption: “Management”, gridview: true, rownumbers: true, rownumWidth: 40, scroll: 0, rowNum: 100, sortname: ‘ID’, pager: ‘#pager’, sortorder: “asc”, viewrecords: true, […]

未捕获的SyntaxError:意外的令牌< – 在jQuery ajax中

我是网络服务的新手。 在我的项目中,我连接Web Service(一切都是现成的),当我试图运行时,我得到了以下错误。 错误 – > Uncaught SyntaxError: Unexpected token < Web服务和我的页面是相同的解决方案,但不同的项目。 相关代码如下: jQuery (URL:11761) function GetAllCategories() { $.ajax({ url: “http://localhost:12015/myWebService.asmx?op=GetCategories”, type: “POST”, dataType: “jsonp”, data: “{}”, contentType: “application/jsonp; charset=utf-8”, success: function (data) { var categories = data.d; $.each(categories, function (index, category) { alert(category.CategoryId); }); }, error: function (e) { alert(e.message); } }); } 网络服务 […]

如何使用jquery“jsonp”调用外部Web服务?

我有一个先前的问题可以jquery ajax调用外部webservice? 一些优秀的开发人员回答我使用jsonp,但我不知道如何使用它,我试图使用此代码调用我的服务: $.ajax({ type: “POST”, url: “http://localhost:1096/MySite/WebService.asmx?callback=?”, data: “{}”, contentType: “application/json; charset=utf-8”, dataType: “jsonp”, success: function(msg) {alert(msg);} }); 这是我的服务代码: [WebMethod] public string HelloWorld() { return “Hello World ” ; } 任何人都有例子或可以为我解释这个问题? 更新 : 我再次编写代码是这样的: $.getJSON(“http://localhost:1096/YourShoppingTest1/WebService.asmx/HelloWorld?jsonp=?”,{name:”test”}, function(data){ alert(data.x); }); 和这样的服务: [WebMethod] public string HelloWorld(string name) { return “( {\”x\”:10 , \”y\”:100} )”; } 但它总是在返回时给我这个错误:“丢失;在声明之前[打破此错误]({”x“:10,”y“:100})” 并且从不调用成功函数,任何人都可以帮忙吗?

跨域jquery ajax请求

我正在通过代码向urlhttp://json-cricket.appspot.com/score.json发送ajax请求 var url=”http://json-cricket.appspot.com/score.json”; $.get(url, function (data) { console.log(data); }, ‘json’); 这不起作用,但如果我添加’ ?callback=? ‘到url,然后它会工作。 即 var url=”http://json-cricket.appspot.com/score.json?callback=?”; $.get(url, function (data) { console.log(data); }, ‘json’); 然后它会工作。 两个url都会给出输出。 只有不同之处在于后者将结果包装在上面?(result) 。 据我所知,谁能解释我发生了什么? 它取自这里 。 任何进一步研究的环节都会非常值得注意。

如何在jBoss中启用CORS

我正在开发一个HTML5应用程序,它必须从遗留Web服务(Jax-Ws)获取一些值,所以我使用jQuery.soap来查询这些Web服务以获取响应。 我已经使用SOAP UI尝试了我的请求的正确性,并且它们正常工作。 从我的HTML5客户端,我无法从服务器接收SOAP响应,因为在响应中没有将Allow-Control-Allow-Origin标头设置为*。 因此,请求的来源被识别为不允许,并且服务器的响应是错误响应。 使用Firebug + Firefox调试我的HTML5项目的错误消息是: 锁定的跨源请求:原点处的标准不允许读取远程资源。 您可以通过将资源移动到同一域或激活CORS来解决问题。 如何在jBoss中启用CORS?