This is a migrated thread and some comments may be shown as answers.

Run existing javascript after callback

2 Answers 106 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
JustinWong
Top achievements
Rank 1
JustinWong asked on 22 Dec 2008, 04:31 AM
Hi:

I've seen the use of the following to trigger a javascript after server-side callback with AjaxManager:

 AjaxManager1.ResponseScripts.Add("alert('Hi')");

However, it seems like that I have to also rewrite the entire javascript out on the server side and place it within the Add().  This is somewhat inconvenient if the javascript is long and complex (e.g.: 100 lines).

In fact, I already have the javascript written inside the aspx page (e.g.: myFunction()) .  Is there a way to just call/trigger myFunction() using AjaxManager1.ResponseScripts directly without having to rewrite the entire block of codes out again on the server side?

Thanks in advance for your help.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 22 Dec 2008, 06:17 AM
Hi,

Here is an example:

 AjaxManager1.ResponseScripts.Add("
myFunction()");

All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
JustinWong
Top achievements
Rank 1
answered on 22 Dec 2008, 07:28 AM
Way cool!  Thanks Vlad!
Tags
Ajax
Asked by
JustinWong
Top achievements
Rank 1
Answers by
Vlad
Telerik team
JustinWong
Top achievements
Rank 1
Share this question
or