Javascript event chaining / binding

Posted by Charlie Brown on Stack Overflow See other posts from Stack Overflow or by Charlie Brown
Published on 2010-05-01T00:10:05Z Indexed on 2010/05/01 0:17 UTC
Read the original article Hit count: 577

Filed under:
|
|
|

I have a select list which has a function with a jQuery .post bound on the change() event.

<select id="location">
<option value="1"></option>
<option value="2"></option>
</select>

$('#location').change(location_change);

function location_change(){
    var url = '';
    $.post(url, callback);
}

What I would like to happen is other controls on the page can bind to the $.post callback function like it was an event, so after the location is changed the data is posted back to the server and once the post returns successfully, the subscriber events are fired.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript