How could I call server-side function from client-side Javascript?

How could I call server-side function from client-side Javascript?

Post by Olga Vinikovetss » Tue, 05 Nov 2002 00:28:19



I have a web-form, a button and server-side function that have to run
when the button is clicked. Looks sipmle, but the web-form and the
function are located in one frame and the button is located in
another.

The only way I know to overcome the gap between two different frames
is JavaScript. But I don't know how could I call server-side function
from client-side Javascript.

Thank you for help.

Olga

 
 
 

How could I call server-side function from client-side Javascript?

Post by Eugene E. Zhukovsk » Tue, 05 Nov 2002 04:27:50


Olga,

In JS that will execute on you button-click, get a reference to the form in
another frame, using document.frames reference, i.e.

var frm = document.frames["<framename>"].forms[0]

Then you can manipulate any objects on that form and call their methods.

Create a hidden textbox on the form, and set its value to something that would
indicate that the button was pressed.

Then submit the form - frm.submit();

On server-side, check the value of that hidden field, and call appropriate
function accordingly.

Hope this helps.

--------
Regards,
Gene
http://www.z-3.us/rdi1



Quote:> I have a web-form, a button and server-side function that have to run
> when the button is clicked. Looks sipmle, but the web-form and the
> function are located in one frame and the button is located in
> another.

> The only way I know to overcome the gap between two different frames
> is JavaScript. But I don't know how could I call server-side function
> from client-side Javascript.

> Thank you for help.

> Olga

--

 
 
 

How could I call server-side function from client-side Javascript?

Post by Jon » Tue, 05 Nov 2002 04:52:10


Use a QueryString in the url then receive and process it
in the other page.

Quote:>-----Original Message-----
>Olga,

>In JS that will execute on you button-click, get a

reference to the form in
Quote:>another frame, using document.frames reference, i.e.

>var frm = document.frames["<framename>"].forms[0]

>Then you can manipulate any objects on that form and

call their methods.
Quote:

>Create a hidden textbox on the form, and set its value

to something that would
Quote:>indicate that the button was pressed.

>Then submit the form - frm.submit();

>On server-side, check the value of that hidden field,

and call appropriate
Quote:>function accordingly.

>Hope this helps.

>--------
>Regards,
>Gene
>http://www.z-3.us/rdi1

>In article



>> I have a web-form, a button and server-side function
that have to run
>> when the button is clicked. Looks sipmle, but the web-
form and the
>> function are located in one frame and the button is
located in
>> another.

>> The only way I know to overcome the gap between two
different frames
>> is JavaScript. But I don't know how could I call

server-side function
Quote:>> from client-side Javascript.

>> Thank you for help.

>> Olga

>--

>.