My ajax call. I am not getting the desired response as string. Can anyone help me in this regard. Thanks in advance.
function Function1() {
alert("In Ajax Call");
$.ajax({
type: "POST",
url: "abc.aspx/MyFunction1",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (res) {
$('#regularticker').html(res.d);
//$('#futureticker').html(res.d);
var d = new Date(); // for now
$('#updateTime').html("Update at " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds());
//alert(res.d.toString());
alert(res);
alert(res.d);
},
error: function (res) {
}
});
}
My Backend Function Called
[WebMethod]
public static string MyFunction1()
{
try
{
if (true)
{
return "test";
}
}
catch(Exception ex)
{
return ex.Message;
}
}