View Single Post
  #1 (permalink)  
Old 03-17-06, 03:09 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Add javascript after load?

Hi,

The idea with the page im working with (co. intra) is that it should never have to load again. All functionality is behind the scenes php and calling it javascript (XMLHttpRequest / Ajax).

I have a form that "submits" with javascript, values to JS vars and sent by ajax methods as POST to a php file.
The php file does some soap action and return eather error or success.

Now the problem.
Incase theres errors, i want to keep the form as it is. if not, i want to reload it.

why this is a problem is simply becourse i wouldint want to go edit the ajax function to check if i got errors back.
Currently the setup is like this:
Code:
+---------+------------+
| F O R M |return data|
+---------+------------+
If there are errors, they are outputted in the return data section along with javascript that reenables the submit button.
Incase there are no errors im outputting javascript that reloads the form, but it seems neather of thease are executed.

Does all javascript have to be loaded to the page at the initial load or is it possible to add javascript at a later time?

Last edited by <?Wille?>; 03-17-06 at 03:13 AM.
Reply With Quote