Tag: web services

如何使用jQuery使用asmx Web服务?

我在网上看到了很多不同的答案,并做了大量的复制和粘贴。 它对我不起作用。 谁能告诉我为什么? 我很沮丧> _ <我是否必须在我的web.config文件上做一些事情? 我不明白,即使我的“WebService.asmx / add”也不会从我的浏览器返回任何内容(因为没有这样的链接。)jQuery将如何得到任何结果? 我必须添加一些httphandler,对吗?

我可以通过webService调用获取gridview的渲染html吗?

是否有一个简单的调用webService方法重新绑定asp.Net GridView控件并返回其呈现的html,以便我可以刷新页面上包含gridview的区域? 我可以使用jQuery.Load但是在服务器端如何获取特定控件的渲染块? 谢谢

validation用户名ajax和json以及asp.net

所以我是json / ajax / jquery / webservices的新手 我正在尝试建立一个连接页面,用户可以输入几个字母,并获得用户名是否可用的即时反馈。 我有一个html文件[用户前端]和一个asmx webservice,webservice检查它是否存在它存在的任何文本[它运行一个工作正常的存储过程] 我的html文件似乎不是调用我的webservice。 我通过转到asmx页面并手动输入值来validationweb服务的工作原理,它为我返回true或false。 一个问题是它似乎是在XML中返回它,如下所示,而不是我想要的json {“available”: false} 所以关于代码/标记! 我的html文件 <!– $(document).ready(function () { var validateUsername = $('#validateUsername'); $('#username').keyup(function () { var t = this; if (this.value != this.lastValue) { if (this.timer) clearTimeout(this.timer); validateUsername.removeClass('error').html(' checking availability…’); this.timer = setTimeout(function () { $.ajax({ contentType: “application/json; charset=utf-8”, url: ‘ValidateUser.asmx/GetUsernameAvailable’, data: […]

jQuery Ajax调用F#?

有没有办法使用jQuery调用f#库而不必将其包装到Web服务方法中?

ASMX相当于RegisterAsyncTask

当ASPX页面需要调用可能长时间运行的操作(冗长的数据库查询,调用远程Web服务等)时,我使用RegisterAsyncTask,因此IIS工作线程被返回到池中,而不是被绑定在长时间运行的持续时间内。 但是,ASMX Web服务没有RegisterAsyncTaskfunction。 当ASMX Web服务需要调用可能长时间运行的操作时,如何实现与RegisterAsyncTask相同的行为? 注意:ASMX webservice是作为脚本服务实现的:将json返回到直接的jQuery / ajax调用。 因此,我不能使用MSDN描述的“BeginXXX”方法,因为它实现了生成的客户端存根中的异步行为(在通过ajax直接调用webservice时不使用)。 编辑 :添加源代码:实现了John的答案中列出的BeginXXX / EndXXX方法。 同步“Parrot”function正常工作。 但异步“SlowParrot”函数给出了内部服务器错误:“未知的Web方法SlowParrot” WebService1.asmx: // Test class implemented according to: http://msdn.microsoft.com/en-us/library/aa480516.aspx [WebService] [ScriptService] public class WebService1 : WebService { // A normal, synchronous webMethod, to prove the overall webservice is working. [WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string Parrot(string key) { […]

通过jQuery在ASMX Web服务中实际使用JSON的示例

任何人都可以推荐一篇关于向asp.net Web服务(任何风格)发送和接收JSON的文章,该文章使用比“hello world”更实用的例子。 理想情况下,涵盖以下主题: 从Web服务接收单个复杂对象(以表单forms显示) 从Web服务接收复杂对象的集合(显示在表中) 将单个复杂对象发送到Web服务(用于更新数据库) 将复杂对象的集合发送到Web服务(用于更新数据库)

Jquery和Web服务:我可以在数据属性中传递多个数组

在这样的事情: $.ajax({ type: “POST”, url: “WebService1.asmx/SendValues”, data: jsonText, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function() { alert(“it worked”); }, failure: function() { alert(“Uh oh”); } }); 如何向Web服务发送多个arrays? 可能吗? 或者我应该发送多维数组?

IE10未将参数传递给AJAX发布请求中的Web服务方法

我有一个JQuery函数,它在Web服务方法上执行AJAX Post。 此function适用于FireFox,Chrome,Safari和IE 9及更低版本。 由于某些奇怪的原因,IE10不传递执行Web方法所需的参数并抛出以下exception: ================================================== ========================= ExceptionType = System.InvalidOperationException Message =无效的Web服务调用,缺少参数值:’parameterX’。 StackTrace = System.Web.Script.Script.Services上System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target,IDictionary 2 parameters) at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary 2参数) System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context,WebServiceMethodData methodData)中的.RestHandler.InvokeMethod(HttpContext context,WebServiceMethodData methodData,IDictionary`2 rawParams) ================================================== ========================= 我试图在AJAX请求中使用各种传递数据的组合,包括JSON.stringify()方法。 没有工作,这似乎是IE10中的一个错误。 这是JQuery函数: var valueX = $inputBox.val().replace(“‘”, “!”); var valueY = 1; myNameSpace.activeAjaxRequest = $.ajax({ type: “POST”, contentType: “application/json; charset=utf-8”, url: webServiceMethodUrl, data: JSON.stringify({ […]

ValidateUserName未定义

我有一个jquery ajax调用asp.net web服务问题。 我想validationasp.net网页中的文本框。 validation器是: jquery代码是(第2次更新): $.ajax({ type: “POST”, url: “UserNameWebService.asmx/ValidateUserName”, data: “{‘strUsername’: ” + $(“#TextUserName”).val() + “}”, contentType: “application/json; charset=utf-8”, dataType: “json” }); General user information Web服务代码是: [WebService(Namespace = “http://tempuri.org/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public […]

在调用Web服务后,无法从我的jquery移动应用程序检索服务器时间

我想问一个关于这个问题的一般性问题,因为我不知道在我的代码或应用程序中哪里可以找到我的问题。 我有一个J Query移动应用程序,它有一个页面通过在SQL中调用getDate来检索数据库服务器时间。 用于检索此时间的sql执行是在Visual Studio中开发的C#Web服务中传递的,该服务返回前端的JSON字符串。 要在C#中调用Web服务,java脚本对包含Web服务的给定URL具有aj Query $ .post命令。 如果我在google chrome firefox浏览器中运行我的应用程序,一切都很好。 移动应用页面会检索正确的时间和正确的日期。 如果我在测试I Phone或I Pad上查看相同的内容,我得到的信息是我几天前或几小时前在浏览器上检索到的信息。 我知道这些信息可能过于笼统,但是有没有人指明我应该在哪个方面看待这个具体问题。 谢谢。