I have following code.
ASPX Page
<a href="AnyASPXPageOfWebsite.aspx" onclick="javascript:CallJQuery();" > Set Price </a>
JS Code
function CallJQuery() {
var prc = document.getElementById('<%= hdnPrice.ClientID %>');
var strPrc = prc.value;
$.ajax({
type: "POST",
url: "/Services/TestService.asmx/SetPrice",
data: {Price : "'"+ strPrc + "'"},
dataType: "json",
error: function(xml, status) {
alert('Error is ' + status);
},
success: function(xml, status) {
alert('suceess' + status );
}
});
}
Webmethod in TestService.asmx
[WebMethod(EnableSession = true)]
public string SetPrice(string Price)
{
HttpContext.Current.Session["ProdPrice"] = Price;
return "success";
}
My code works in every browser except SAFARI i set breakpoint at SetPrice() method,but its not executed in case of safari. Also success function is executed and alert message is displayed
What is the reason for safari that method is not executed?
I searched a lot for solution, applied many codes but nothing works I concluded that Following is not possible in safari. If In asp.net c# page,if you have tag with href property set to "any aspx or html page" and tag has "onclick" event which excutes some JS function which then executes "Web method" using JQuery Callback. This situation does not work and webmethod is not executed in such scenario because safari browser executes JS function and then navigate to page(set in href property),but not calling webmethod.
that's all as per my research.