I have a java script function which returns value of status. My function is as follow :
function IsReportAlreadyExists() {
var result=true;
$.ajax({
type: "POST",
url: "ReportDetail.aspx/CheckReport",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
if (msg.d != "") {
result= confirm(msg.d);
}
},
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
return result;
}
I am calling this function on client click event of a asp.net button control.
<asp:Button ID="btnSave" Style="margin-right: 10px" runat="server" CausesValidation="false"
OnClick="btnSave_Click" Text="Save" Width="70px" OnClientClick="return IsReportAlreadyExists();" />
On client click of button javascript function always return a true value.I mean i am not getting the value of result which is set by confirm(msg.d). Is there any method to achieve this ? Please help me guys. Your help will be really appreciated.
Thanks,Rajbir