c# - Save data to DB using JQuery ajax on button click -
here jquery ajax method:
$(document).ready(function () { $("input[id$='btnbulten']").click(function () { //alert("dd"); $.ajax({ type: "post", url: "http://url/controls/ebulten.ascx/ebultensend", contenttype: "application/json; charset=utf-8", data: "{namesurname:" + $("input['id$='$txtnamesurname']").val() + " }", datatype: "json", success: function (msg) { alert("mesajınız başarıyla iletildi"); } }); }); });
and in codebehind code:
[webmethod()] public static void ebultensend(string namesurname, string email, string ip, string position, string firmname) { int bultenid = ebulten.insertebulten(namesurname, email, ip, position, firmname); }
insertebulten calling sp save data db. parameters comes textboxes. not able save data database.how can fix this? normally, without webmethod, if use method on client click, inserts data db.
Comments
Post a Comment