1

I am using Page Methods in ASP.NET, in the code behind I have written a method which should call a JavaScript function for each loop, then it should come back and continue the loop.

Is it possible?

[WebMethod]
public static void GetStatus()
{
    for (int i = 0; i < 10; i++)
    {
        System.Threading.Thread.Sleep(500);
        //Call javascript function
    }

}

Any help will be greatly appreciated, thanks.

2 Answers 2

1

The client and server don't talk to each other - sounds like you need to call the web method over and over again from javascript for each value.

Sign up to request clarification or add additional context in comments.

1 Comment

yes you are right As far as i know it is not possible.But, I m not sure
0

It looks like you are trying to implement a call back mechanism. Take a look at this MSDN article. From what i understand you want to do something like: 1. Call a page/web method via JS 2. Call some JS method when page/web method returns or is done.

Maybe u should expand the question

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.