I have the following JS code
<script type="text/javascript">
$(document).ready(function () {
$("#innerDiv1").ajaxStart(function () {
alert($(this).attr("id") + " ajaxStart");
});
$("#innerDiv2").ajaxStart(function () {
alert($(this).attr("id") + " ajaxStart");
});
$("#button").click(function () {
$.post("test.aspx");
});
$("#button1").click(function () {
$.post("test.aspx");
});
});
</script>
My problem is that whenever I click the “button” or “button1” both ajaxStart events are invoked even though the ajaxStart handlers are bound with unique elements
I would like to invoke only one ajaxStart, the one according to which button I click on, is this possible?
UPDATE…
After reading the answers and also finding out that it is not possible…can anyone explain the reason why the ajaxStart can be bound with an element??
Thanks
ajaxStartis a global Ajax event.. that means that all ajaxStart events you bind will be triggered in each Ajax call you make..quoting from http://api.jquery.com/ajaxstart/
If you want something different for each call then just do what you want in the button click..
something like
update
how about