Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i think there is an issue in your code:</p> <p>You pass the individual field in your "data" i.e. <strong>"id,post"</strong>, while your action method expect list of <code>SpecimenViewModel</code> object. You should pass <code>specimens</code> object instead.</p> <p>First, try sending correct data, and if still the problem persists, just change your return of POST method to <code>return this.View();</code> instead of <code>return RedirectToAction("DoctorSlip");</code></p> <p>I prepare a slight different version from your code which you can try:</p> <pre><code>@using (Html.BeginForm("DoctorSlip","Test",FormMethod.Post,new {id="saveform"})) { &lt;!-- your other input controls --&gt; &lt;input type="button" id="submitForm" value="Save"/&gt; } </code></pre> <p><strong>Script :</strong></p> <pre><code>&lt;script&gt; $(function() { $("#submitForm").click(function () { var myRows = []; myRows.push({ id: 1, site: "abc", clinicalImpression: "aa", degreeOfSuspicion: "test", margins: "24", count: "12", lesionSize: "33", }); myRows.push({ id: 2, site: "abc2", clinicalImpression: "aa3", degreeOfSuspicion: "test2", margins: "24", count: "12", lesionSize: "33", }); var specimens = JSON.stringify(myRows); var url = '/Test/DoctorSlip'; $.ajax({ url: url, data: specimens, type: 'POST', dataType: 'json', statusCode: { 404: function() { alert('Could not contact server.'); }, 500: function() { alert('A server-side error has occurred.'); } }, success: function() { alert('success'); }, error: function (xhr, ajaxOptions, thrownError) { alert('an error' + thrownError); } }); }); }); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload