How to loop through POST variables sent to ASP.NET WebMethod from JQuery $.ajax method? -


I have created a checklist with the HTML button, which, between the 'Selected' and 'No Selected' sections on the click Toggle it. Each option has an ID related and also has an optional comment input.

I send JQuery $ with POST to send selected IDs and related ID IDs. I am trying to use the AJAX () method. I have the idea that the key / value of the selected ID is for collection and related comments, when 'Save' is clicked in such a way:

  selections = "{id1 : 'Comment1', id2: 'comment2', ...} "  

Then pass it into the data section of the $ .ajax () method:

 Data type: "App / Jason; Charset = UTF-8", Datatype: "Jason", success: Work (msg) {onsuit ()}}}); Use selections by looping through   

and finally MyMethod by using HttpContext.Current.Request.Form .

But when I try this, HttpContext.Current.Request.Form is always empty, is my view wrong? If so, why? Can someone recommend another?

Any help would be greatly appreciated thanks in advance!

In addition, I know four ways to call a server method from the jQuery AJAX API:

  1. The page method (along with the static method in the .aspx page [WebMethod] modifier) ​​
  2. Switch between statements between methods in Page_Load of an .aspx page
  3. Switch between statements <.>
  4. Web service

    How is the most efficient? I think 2 would include an unnecessary example of a page, so that it is not one.

    The selection variable should not be an object string.

      Var selection = {id1: 'a', id2: 'b'};    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -