I have a form laid out as a spreadsheet. When the user leaves the line, I want to send the fields from this line to the server using jQuery Ajax. The page is one big form, so itโs actually not javascript that calls the submit button script - the form is huge, and I want to send a small part of the content because of speed.
I have written code that identifies a string and iterates through fields in a string. My problem is how to create a dat object to present something that is understandable. I can disassemble and store on the server.
At the moment, my code looks like this:
var dat=[]; $("#" + finalrow).find("input").each(function () { var o = $(this).attr("name"); var v = $(this).val(); dat.push({ o: v }); }); $.ajax({ url: 'UpdateRowAjax', dataType: 'json', type: 'POST', data: dat , success: function (data) { renderAjaxResponse(data); } });
Data collection does not work at all. So, how should I create this dat object so that it โlooksโ as much as the form representation as possible.
source share