Niraj Choubey
Niraj Choubey

Reputation: 4040

calling javascript from server side

How to call javascript function from server side

Upvotes: 3

Views: 5252

Answers (2)

Oded
Oded

Reputation: 499352

You can simply do a Response.Write("<script language='javascript'>nameOfJavascriptFunction();</script>"), or use ClientScriptManager.RegisterClientScriptBlock with a similar script.

The effect is that you are outputting a script tag calling your function - the call is still done on the client side.

Upvotes: 5

Tommy Andersen
Tommy Andersen

Reputation: 7230

How about having the client side polling the server for actions instead? Do a call to the server side to check for a certain state, and if that state is fulfilled call the function? Should be easily achieved.

Upvotes: 0

Related Questions