Ajax function not updating the data. Data load in dialogbox of bootstrap and i need to update the data with changes.i also check in browser the value is come from dialog box
I think you should post your data without stringifying your JSON:
$("#UpdateTbl").click(function () {
var id = $(this).attr("edit-id");
var user = {};
debugger;
user.DayDesc = $("#DaybookDesc1").val();
user.VoucherNo = $("#Prifix1").val();
user.VoucherNo1 = $("#Surffix1").val();
$.ajax({
type: "Post",
contentType: "application/json; charset=utf-8",
url: "DaybookMast.aspx/UpdateData",
data: {"objEmployee": user, "eid": id},
dataType: "json",
success: function (data) {
if (confirm("Are you want to change !") == true) {
alert("Updated successfully");
} else {
alert("canceled changes");
}
},
error: function (data) {
alert("Error while Updating data of :" + id);
}
});
});
On a side note: don't do SQL injection in your DB statements... Use parameters instead to avoid possible security breaches. More info @ https://stackoverflow.com/a/6548006/2805121