Okay, what I''m trying to do is allow a form to submit as normal, while
at the same time hijack it and consecutively send the data to a
another location via Ajax. Here''s my method:
Event.observe(window, ''load'', function(event) {
var form = $$(''form'').first() || $(''form'');
var url = ''/campaigns/'' + campaign_id +
''/responses'';
Event.observe(form, ''submit'', function(event) {
new Ajax.Request(url, { method: ''post'', parameters:
form.serialize(true) });
});
});
The problem is that in Safari 3, the event (submitting the form)
completes before the Ajax call has a chance to fire. I tried this:
Event.observe(window, ''load'', function(event) {
var form = $$(''form'').first() || $(''form'');
var url = ''/campaigns/'' + campaign_id +
''/responses'';
Event.observe(form, ''submit'', function(event) {
new Ajax.Request(url, {
method: ''post'',
parameters: form.serialize(true)
onComplete: function() {
form.submit();
}
});
event.stop();
});
});
The problem there is the original location that I''m submitting the
form to doesn''t seem to like it when the form is submitted via
form.submit(). Not sure how it can tell the difference, but somehow it
does. Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---