I call a javascript pop up after I click a button.
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "doajax();", true);
This then shows two buttons confirm or cancel.
I need to be able to call a method in my code behind if I click confirm.
<script type="text/javascript">
function doajax() {
$.ajax({
type: "POST",
url: 'Application.aspx/Function',
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
$("#divResult").html("success");
//I need to call my code behind method here
},
error: function (e) {
$("#divResult").html("Something Wrong.");
}
});
}
</script>
I have tried several things but nothing hits my method.
Any help would be appreciated.
Grant