web services - jquery/ajax- post an array (not empty) to a c# webservice's function -


I try to pass a masonry that has a webservice function in two integers:

 [Code] [WebMethod] [ScriptMethod (UseTataget = True, Response format = Response format. Jason)] Public Boole Sample (Int number, int [] no) {Return (numbers (. (>> Number); }   

I do this with jquery.ajax:

  var arr = ['20', '89']; $ Ajax ({url: "registration.asmx / sample", data: jquery.most ({'number': '300', 'number []': arr}), type: "post", success: work (data Html (data.toString ());}, Error: Work (xhr, ajaxOptions, thrownError) {$ ('# result'). Html (jQuery.param ({'number' : '300', 'number': arr}) "

" + thrownError + "

















But I get an internal error about an empty array (I think)  none

Change:

  Day D: jQuery Param ({'number': '300', 'number []': arr}),   

to:

  data: jQuery .param ({'number': '300', 'numbers': arr}),   

edit:

The method that receives requests is:

  [ScriptMethod (UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]   

But in Javascript you get the POST Using:

  type: "post",   

change it to:

  type: "received ",    

Comments