change prototype script to jquery one

Posted by steve on Stack Overflow See other posts from Stack Overflow or by steve
Published on 2010-03-30T19:24:43Z Indexed on 2010/03/30 19:33 UTC
Read the original article Hit count: 303

Filed under:
|
|
|

I have this form submit code:

Event.observe(window, 'load', init, false);
function init() {
  Event.observe('addressForm', 'submit', storeAddress);
}
function storeAddress(e) {
  $('response').innerHTML = 'Adding email address...';
  var pars = 'address=' + escape($F('address'));
  var myAjax = new Ajax.Updater('response', 'ajaxServer.php', {method: 'get', parameters: pars});
  Event.stop(e);
}

How can I change it to work with jQuery?

Here is the html form:

<form id="addressForm" action="index.php" method="get">
  <b>Email:</b> <input type="text"  name="address" id="address" size="25"><br>
  <input name="Submit" value="Submit" type="submit" />
  <p id="response"><?php echo(storeAddress()); ?></p>
</form>

and this is php code at start of document:

<?php
require_once("inc/storeAddress.php");
?>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about prototype