failed jquery call of page method
<p>I'm trying to save data from HTML table to database using jquery to call a page method.
However, jquery call fails with : 500 internal server error..
Any advice?</p>

<p>Below is the code:</p>

<p>SCRIPT:</p>

<p></p>

<pre><code>    $(document).ready(function() {


        $("#save").click(function(event) {

            var i = 0;
            var inputs = new Array();
            $("#tbNames").find("input").each(function() {         
                inputs[i] = [this.id, this.value];
                i++;
            });

            var columnsCount = 2;
            $.ajax({

                type: "POST",
                url: "Default2.aspx/Save",
                contentType: "application/json; charset=utf-8",
                data: "{inputs: inputs, columnsCount: columnsCount}",
                dataType: "json",
                success: AjaxSucceeded,
                 error: AjaxFailed
            });
        });
        function AjaxSucceeded(result) {
            alert(result.d);
        }

        function AjaxFailed(result) {
            alert(result.status + ' ' + result.statusText);
        }

    });



    &lt;/script&gt;
</code></pre>

<p>HTML:</p>

<p>
    
          
                       
                           Name
                           Task
                          Delete
                       <br />
                       
                          
                          
                          
                       <br />
             </p>

<pre><code>    &lt;input id="save" type="button" value="Save data" /&gt;
</code></pre>

<p>
    </p>

<p>and C# code of page method:</p>

<pre><code> [WebMethod ()]
    public static List&lt;Hashtable&gt; ParseJson(string[] array, int rowsCount)
    {
    var result = new List&lt;Hashtable&gt;();

    List&lt;string[]&gt; list = new List&lt;string[]&gt;();
    foreach (var item in array)
    {
        int comma = item.IndexOf(',');
        list.Add(new string[] { item.Substring(0, comma), item.Substring(comma + 1) });
    }

    int i = 0;
    while (i &lt; list.Count)
    {
        var dict = new Hashtable();
        int j = i + rowsCount;
        for (; i &lt; j; i++)
        {
            dict.Add(list[i][0], list[i][1]);
        }

        result.Add(dict);
    }

    return result;

}

[WebMethod()] 
public static string Save(string[] inputs, int columnsCount)
{
    List&lt;Hashtable&gt; r = ParseJson(inputs, columnsCount);

    List&lt;TestClass&gt; listOfTasks = new List&lt;TestClass&gt;();
    foreach (var item in r)
    {
        TestClass tc = new TestClass();
        tc.name  = (string)item["name"];
        tc.task = (string)item["task"];

        listOfTasks.Add(tc);
    }

    DBManager dbm = new DBManager();
    string actionResult = dbm.SaveData(listOfTasks);
    if (actionResult == String.Empty)
    {
        return "Saved!";
    }
    else
    {
        return actionResult;
    }
}
</code></pre>
