[eluser]thinkigniter[/eluser]
Hi ammonkc,
Welcome to the forum.
I'm also a big fan of JQ and have never tried Prototype so I was also interested.
So after reading your post I googled
prototype ajax form submit.
The second link was
24 ways: Easy Ajax with Prototype.
So I clicked on this [email=http://24ways.org/2005/easy-ajax-with-prototype]link[/email] and clicked on {[email=http://24ways.org/examples/easy-ajax-with-prototype/]Try the example[/email]} at the bottom of the page.
The code behind this great example was...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Easy Ajax</title>
[removed][removed]
[removed][removed]
</head>
<body>
<form method="get" action="greeting.php" id="greeting-form">
<div>
<label for="greeting-name">Enter your name:</label>
<input id="greeting-name" name="greeting-name" type="text" />
<input id="greeting-submit" name="greeting-submit" type="submit" value="Greet me!" />
</div>
<div id="greeting"></div>
</form>
</body>
</html>
I checked out the source of the ajax.js file and...
Code:
Event.observe(window, 'load', init, false);
function init(){
$('greeting-submit').style.display = 'none';
Event.observe('greeting-name', 'keyup', greet, false);
}
function greet(){
var url = 'greeting.php';
var pars = 'greeting-name='+escape($F('greeting-name'));
var target = 'greeting';
var myAjax = new Ajax.Updater(target, url, { method: 'get', parameters: pars});
}
I noticed a lovely little initialisation
init() function with a, well named, event observe feature passing the contents of the
greeting-name textbox to the greet() function every time the keyboard key came up. O'h and it also ignored any return.
The
greet() function then, after doing some housekeeping with posted(get..ed) content, used the magic Ajax.Updater, again well named, feature to send this information to the
greeting.php file.
It took me 2 minutes to track this example down and another 10 minutes to reply to this post.
Isn't it amazing what you can do with, in my case, a PC, google, common sense and the internet!
Cheers