Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AJAX RPC Call 1

Status
Not open for further replies.

seabaz2000

IS-IT--Management
Feb 24, 2006
79
IE
Hi,
Just wondering would anyone know of any examples of code on the web where when a user sets an object client side a remote procedure call is made using AJAX to update a session variable server side?
 
It all comes down to what you mean by "a user sets an object client side". There is no (native) way to trigger on an object being set in Javascript... so unless I misunderstand your question, there would be no point in getting code to do something via AJAX - if you could never trigger it [smile]

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
You could build your own "setter" method and fire off an AJAX call... but you would have to always remember to use the setter instead of setting the object directly.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
To answer the first reply, the object in question is a value called orderdate. It is a hidden field that comes with the calendar from this website. When a user selects a particular date from the drop down lists etc, I want that date to be passed to a session object on the server. Is AJAX the only way to do this or is there another way I am overlooking.
 
What would the setter method in question look like. Are there any examples I could go off.
Thanks again for all the help guys.
 
The reason you've been given the answers that you have is that you've been talking about an object... and this now turns out to not be the case - you're talking about an input element, not an object.

If you want to fire an AJAX call when the value of an input element changes, that's no problem - simply put an "onchange" event on the input that fires your call off.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
To answer your second question - you could do this without AJAX simply by submitting the form "onchange" - but if you want to do it without leaving the page, then AJAX (or an iframe) would be the way to go. It might well be that submitting the form via an iframe is a whole lot easier.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top