Is it possible to send a form and a html request with same Event by Mootools?
$('submitbutton').addEvent( 'submit', function(e)开发者_如何转开发{
e.stop();
$('fuss').send();
req2.send();
});
trying to get this working but not sure if it is possible and had no success so far. Mootools docs doesnt helped me either. Will the multiple usage of .send() work? Do i have to specify the data beeing send for the html request or does it take automatical the data beeing send by the form ?
It's in the documentation: http://mootools.net/docs/core/Request/Request#Element:send
This shorthand method will do a request using the post-processed data from all of the fields.
You can do as many requests in a specific event as you wish, as long as they're all asynchronous.
In your specific example it would seem you want to do two requests using two different methods, one with setting up a new Request
class manually and the second doing it via the Element Method.
Based on your last comment, I wrote a little example in jsFiddle. Basically I think you don't need two request for your goal. Just override onRequest method to update the html.
精彩评论