I have an ajax form, for example ...
<form action="/whatever" method="POST" id="blerg">
</form>
This is an ajax event bound to it like this when the form is submitted:
$("#blerg").bind('ajax:before', function(xhr, settings){
alert("xxx");
}).bind('ajax:success', function(xhr, data, status){
alert("xxx");
});
Now, if I put the link in the form as follows:
<form action="/whatever" method="POST" id="blerg">
<a id="some_ajax_link" href="#">Some ajax link</a>
</form>
And then attach the ajax events to this link like this:
$("#some_ajax_link").bind('ajax:before', function(xhr, settings){
alert("yyy");
}).bind('ajax:success', function(xhr, data, status){
alert("yyy");
});
When I click the link inside the form. It triggers both ajax event forms and link events.
How can I make a link just start its own events, and not the forms in which it entered?
Thanks.
source
share