How to post the Code Ajax Post With Array

Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 1056
I have post the Code Ajax Post With Array

function SaveToDbs() {
var myCars = new Array();
myCars[0] = document.getElementById("<%= TxtTab1.ClientID %>").value;
myCars[1] = document.getElementById("<%= TxtTab2.ClientID %>").value;
myCars[2] = document.getElementById("<%= TxtTab3.ClientID %>").value;

type: "POST",
url: "/InsertCust.aspx/SaveToRecords",
data: JSON.stringify({ arr: myCars }),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function (XMLHttpRequest, textStatus, errorThrown) {
success: function (result) {
return false;

<System.Web.Services.WebMethod()> _
<Script.Services.ScriptMethod(responseFormat:=Script.Services.ResponseFormat.Json)> _
Public Shared Function SaveToRecords(RecStr As List(Of String)) As String
End Function

Comments or Responses

Login to post response