Tag: asmx

使用JQuery调用WebMethod

我无法从我的JQuery调用进入我的Search WebMethod。 也许有人可以帮我指出正确的方向。 我还将所有内容打包成一个zip文件,因为有人想要仔细检查一下。 http://www.filedropper.com/jsonexample 谢谢瑞恩 JSON Example function Search() { var search = $(“#searchbox”).val(); var options = { type: “POST”, url: “Default.aspx/Search”, data: “{text:” + search + “}”, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function(msg) { alert(‘Success!’); } }; $.ajax(options); } Search 这是default.aspx背后的代码 Imports System.Data Imports System.Web.Services Imports System.Web.Script.Serialization Partial Class _Default Inherits System.Web.UI.Page […]

使用jquery调用ascx页面方法

我知道我可以使用以下语法使用jquery调用页面方法 $.ajax({ type: “POST”, url: “Default.aspx/GetDate”, data: “{}”, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function(msg) { // Replace the div’s content with the page method’s return. $(“#Result”).text(msg.d); } }); 这适用于aspx页面但是可以使用ascx页面吗? (网页控制) 我已经尝试了大约半个小时,因为我无法让它工作,我想知道它是否可能。 注意:为了清楚,当我尝试调用ascx页面时,我正在更新jquery中的url 🙂

asmx web服务,json,javascript / jquery?

我正在使用asmx从DB中检索一些数据, public class TestPage1 { public int UserID { get; set; } public string UserName { get; set; } public string Password { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string MiddleName { get; set; } } [WebMethod] public EntityLayer.TestPage1 GetData(int id) { TestPage1 […]