below is my code which return name that is entered in textbox in the web method and displays the name current time and date as output now what i need is i only need to pass the name to another method how can i do this
C#
function ShowCurrentTime() {
PageMethods.GetCurrentTime(document.getElementById("").value, OnSuccess);
}
function OnSuccess(response, userContext, methodName) {
alert(response);
}
Your Name :
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]
public static string GetCurrentTime(string name)
{
return "Hello " + name + Environment.NewLine + "The Current Time is: "
+ DateTime.Now.ToString();
}now what I need is I need another method only with name that is obtained from WebMethod and on button click I need to display the name with

Ravi PatelRank #439 · 5.7K reputationPosted Jul 6, 2016, 5:51 AM EDT
function ShowCurrentTime() { PageMethods.GetCurrentTime(document.getElementById("").value, OnSuccess); } function OnSuccess(response, userContext, methodName) { // here split() function convert your string into array of string var array = response.split("");var name = array[1]; // now you can pass the this name into another function otherMethod(name); alert(response); } function otherMethod(Name) { alert(Name); }protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]
public static string GetCurrentTime(string name)
{
return "Hello " + name + Environment.NewLine + "The Current Time is: "
+ DateTime.Now.ToString();
}