title: how to use jquery to send a parameter array to an asp.net web method
body: <p>using the jquery below I'm trying to submit the array paramlist to the appropriate web method below.  What am I missing here?</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
  
              var slider = $('.slider').slider({
                  range: "min",
                  min: 0,
                  max: 100,
                  change: function (e, ui) {
  
                      var paramList = new Array();
  
                      var values = $('.slider').each(function () {
                          var s = $(this);
                          var aType = s.attr('itemName');
                          var point = s.slider("option", "value");
                          paramList.push(aType);
                          paramList.push(point);
  
  
                      });
  
                      CallPageMethod("SliderChanged", paramList, success, fail);
                      //                    $("#img1").fadeOut();
                      //                    alert("done");
                  },
                  slide: function (e, ui) {
                      var point = ui.value;
                      $("#selected_value").html(point);
                      //                    var width = 100 - point;
                      //                   $("#range").css({ "width": point + "%" });
                  }
  
              });
  
              function CallPageMethod(methodName, paramArray, onSuccess, onFail) {
  
                  //create list of parameters in the form
                  //{"paramName1":"paramValue1","paramName2":"paramValue2"}
  
                  var paramList = '';
                  if (paramArray.length &gt; 0) {
                      for (var i = 0; i &lt; paramArray.length; i += 2) {
                          if (paramList.length &gt; 0) paramList += ",";
                          paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"';
                      }
                  }
                  paramList = '{' + paramList + '}';
  
  
                  //get the current location
                  var loc = window.location.href;
                  loc = (loc.substr(loc.length - 1, 1) == "/") ? loc + "default.aspx" : loc;
  
                  //call the page method
                  $.ajax({
                      type: "POST",
                      url: loc + "/" + methodName,
                      data: paramList,
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: onSuccess,
                      fail: onFail
  
                  });
  
              }
  
  
              function success(response) {
  
                  var lbl = $('#&lt;%= Label1.ClientID %&gt;')
                  lbl.html("Your report is now ready for download.");
                  alert(response.d);
  
              }
  
              function fail(response) {
                  alert("An error occurred.");
              }
  
          });
  
  
     &lt;/script&gt;
  </code></pre>
  
  <p>I have the following web methods:</p>
  
  <pre><code>  [WebMethod]
      public static string SliderChanged(string[] values)
      {
  
          return "successArray";
  
  
      }
  </code></pre>