0

I am trying to convert this code from Protoytpe to JQuery:

Event.observe(window, 'load', init, false);
function init(){
 Event.observe('signup','submit',storeAddress);
}
// AJAX call sending sign up info to store-address.php
function storeAddress(event) {
 // Update user interface
 $$('response').innerHTML = 'Adding email address...';
 // Prepare query string and send AJAX request
 var pars = 'ajax=true&email=' + escape($F('email'));
 var myAjax = new Ajax.Updater('response', '/mailchimp/store-address.php', {method: 'get', parameters: pars});
 Event.stop(event); // Stop form from submitting when JS is enabled
}

Any help appreciated!

Rob W
351k87 gold badges811 silver badges683 bronze badges
asked Aug 15, 2010 at 17:41

1 Answer 1

3
$(function() {
 $('#signup').submit(function(e) {
 var el = this;
 e.preventDefault()
 $('response').html('Adding email address');
 $.ajax({
 url:'/mailchimp/store-address.php',
 data: 'ajax=true&' + $(el).serialize(),
 success:function(){}
 });
 });
});

This should get you started and you can fill in the missing parts or modify it. Remember to reference the API.

answered Aug 15, 2010 at 17:46
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.