开发者

Accepting a serialized form from jquery in asp.net

开发者 https://www.devze.com 2023-03-02 02:54 出处:网络
In asp.net mvc it\'s pretty easy to receive a form collection in a ajax page webmethod like: public bool AddSomething(FormCollection form)

In asp.net mvc it's pretty easy to receive a form collection in a ajax page webmethod like:

public bool AddSomething(FormCollection form)
{
   return true;
}

How do I receive serial开发者_如何学运维ized data in an asp.net page method:

  [WebMethod]
  public static string AddSomething(??)
  {
     //...
     return true;
  }


i am not sure what you are asking about but if you are talking about how to send form data in serialize way using ajax then you can try this...

 url='your url'
    $.post(url,$('#formId').serialize(), function(responseValue) {
                        alert(responseValue);
    });

updated:

[WebMethod]
  public static string AddSomething()
  {
    string foo = Request["form element name"];//example
     return true;
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消