Update database with ajax on button click

Posted by Sina under ASP.NET AJAX on 6/6/2013 | Points: 10 | Views : 1591 | Status : [Member] | Replies : 0
I have an ajax function in a javascript which is to update database on button click; below is the ajax snippet. What is the mistake in this code?
I mean the database is not getting updated!!

<pre lang="cs">&lt;script type=&quot;text/javascript&quot;&gt;

function sav() {

var class_id5 = document.getElementById(&#39;ddlClass5&#39;);
var class_id6 = document.getElementById(&#39;ddlClass6&#39;);
var class_id7 = document.getElementById(&#39;ddlClass7&#39;);
var subj_id = document.getElementById(&#39;ddlSubject&#39;);
var mark5 = document.getElementById(&#39;txtMark5&#39;);
var mark6 = document.getElementById(&#39;txtMark6&#39;);
var mark7 = document.getElementById(&#39;txtMark7&#39;);

$.ajax({
type: &quot;POST&quot;,
url: &quot;Student.aspx/SaveData&quot;,
data: {&quot;class_id5&quot;: class_id5, &quot;subj_id&quot;: subj_id, &quot;mark5&quot;: mark5, &quot;class_id6&quot;: class_id6, &quot;class_id7&quot;: class_id7,
&quot;mark6&quot;:mark6,&quot;mark7&quot;:mark7},
contentType: &quot;application/json; charset=utf-8&quot;,
dataType: &quot;json&quot;,
success: alert(&quot;success&quot;)});



}





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

@Sina


Responses

(No response found.)

Login to post response