Hello
I have written the functions below, to submit a form and load the
information into a div tag. I was having problems with the timing. The
page was retrieved before the update had been completed. I have placed
a JavaScript function to wait 1 second before calling the updater.
Is there a better way to do this!
Many Thanks Graham
function insertdirector()
{
 	var options = {
		method : ''post'',
		parameters : Form.serialize(''directors''),
		 onComplete :
wait(''display_directors'',''updatedirectors()'')
	};
	try {
		new Ajax.Request(''insert_director.php'', options);
	}
	catch (e)
	{
		alert(''Error: '' + e.toString());
	}
}
function wait(layer,func){
	document.getElementById(layer).innerHTML
document.getElementById(layer).innerHTML + ''Updating Please
Wait!'';
	setTimeout(func,1000);
}
function updatedirectors() {
	var ajax = new Ajax.Updater(
         ''display_directors'',        // DIV id (XXX: doesnt
work?)
         ''select_directors_1.php'',        // URL
         {method:''get''
             });
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---