On aspx I have this
function ShowCurrentTime() {$.ajax({
type: "POST",
url: "JSFireCSharp.aspx/GetCurrentTime",
data: '{name: "' + $("#<%=txtUserName.ClientID%>")[0].value + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function(response) {
alert(response.d);
}
});
}Then I have this in code behind
[System.Web.Services.WebMethod]
public static string GetCurrentTime(string name)
{
return "Hello " + name + Environment.NewLine + "The Current Time is: "+ DateTime.Now.ToString();
(((Here I want to add a line Label1.Text = name but get error))))
}
I want to add a line Label1.Text = name but get error. It seems I am not able to gain access to Label1.
Pls help. What can I do ? Thanks