I'm pulling in data from a HTML form and converting it to a JSON object to be sent to a WebMethod.

Right now it says that I'm getting a success response, but I'm not sure how to check that it is correctly being sent to the WebMethod. I've tried debugging in VS2015, but can't seem to get to the break point.

How can I test to see that I've set this all up correctly?

Here is my html:

 <form id="addForm" name="addForm">
     <input type="text"  name="playername" id="playername" placeholder="Player"/> 
     <input type="text" name="points" id="points" placeholder="Points" />
     <input type="text" name="steals" id="steals" placeholder="Steals" />
     <input type="text" name="blocks" id="blocks" placeholder="Blocks" /> 
     <input type="text" name="assists" id="assists" placeholder="Assists" />
     <input type="text" name="mpg" id="mpg" placeholder="MPG" /> 
     <input type="text" name="shotpct" id="shotpct" placeholder="Shot %" />
     <input type="text" name="threepct" id="3pct" placeholder="3 %" /> 
     <input type="button" value="add player" id="addbtn" name="addbtn" />

My Ajax

$("#addbtn").click(function () {
                var form = JSON.stringify($("form").serializeArray());

                    method: 'POST',
                    url: "players.aspx/addRow",
                    data: form,
                    success: function (data) {
                    error: function () {

and the web method where I'm trying to send the data

        public static void addRow(string form)

            dynamic players = JObject.Parse(form);

I'd like to what data is in players, if any (maybe getting a false positive from the AJAX).

Related posts

Recent Viewed