I have an anchor that when clicked makes an ajax call to load some html into a div and then load a script. I want to unbind that event after the first click, and replace it with another click event that toggles between showing and hiding that div. I've got this far, but none of my attempts to register the click event that toggles the div work.
$('#anchor').click( function() {
$('#div').load('file.html', function() {
$.getScript('script.js');
$('#anchor').unbind();
});
});