I wrote a function that submits data from a form to the server using
an AJAX-call. More specific: a user can enter his or her email-address
to subscribe to a newsletter. This works fine in Firefox, but Internet
Explorer gives me an error that isn't very specific: "invalid
argument". I am sure that I did something wrong, but I can't figure
out what it is.

This is the JS-code:
# function initNewsletterSubscription(){
#   if ($('newsletterformsubmit')){
#     $('newsletterformsubmit').addEvent('click', function(el) {
#       el.stop();
#       $('newsletterform').set('send', {onComplete: function
(response) {
#         if (response == 1){
#           $('newsletterform').set('html', 'Thanks for
subscribing!');
#         }
#       }});
#       $('newsletterform').send();
#     });
#   }
# }

This is the HTML-code:
# <form id="newsletterform" method="post" action="subscribe.php">
#   <label for="newsletter-email">E-mail adres</label>
#   <input type="text" id="newsletter-email" name="email"
class="formdescription">
#   <div class="btn_more">
#     <a href="#" id="newsletterformsubmit">verstuur</a>
#   </div>
#   <input type="hidden" name="action" value="subscribeNewsletter">
#   <input type="submit" value="submit" class="submitbutton">
# </form>

Note: the submit-button is hidden in the CSS so I can use the <a> to
submit. Probably not the most elegant solution.

Reply via email to