Welcome Guest, Not a member yet? Register   Sign In
help with unobtrusive ajax with prototype
#1

[eluser]ammonkc[/eluser]
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. Thanks
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;
  })
})


Messages In This Thread
help with unobtrusive ajax with prototype - by El Forum - 07-16-2008, 03:39 PM
help with unobtrusive ajax with prototype - by El Forum - 07-16-2008, 04:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB