FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

help with unobtrusive ajax

 


ammonkc
I need to submit a form via ajax with prototype.js unobtrusively. How do I unobtrusively attach the script to submit with prototype? I've done it with jQuery before, but I need to use prototype on this one. Basically I need to do with prototype.js what the below script does with jquery.js. I would appreciate any help.
Code:

$(function() { // onload...do
  $('#contestForm').submit(function() {
    var inputs = [];
    $(':input', this).each(function() {
      inputs.push(this.name + '=' + escape(this.value));
    })
    jQuery.ajax({
      data: inputs.join('&'),
      url: this.action + '?type=ajax',
      timeout: 2000,
      error: function() {
        console.log("Failed to submit");
      },
      success: function(r) {
        jQuery.facebox(r);
      }
    })
    return false;
  })
})
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.