jquery - dynamically loading/unloading your code
<p>Situation: You are trying to test some javascript at the middle/end of some long process (e.g. a long painful multiustep form) and instead reloading the page and filling out the form again you'd like some way to dynamically reload your script.</p>

<p>My rudimentary solution :</p>

<pre><code>$(document).ready( function() {
    $("#downloadPdf").click( function(e) {
        var url = '/teachers/pdf.js';
        var success;

                // unbind the current click
        $("#downloadPdf").unbind('click');

                // reload your script
        $.ajax({
            url: url,
            dataType: 'script',
            success: success
        });

                // this is the regular part of your code
})
</code></pre>

<p>Obviously this is easy to do if you have not very much code, but if you have a lot more code I could see this getting messy. Any better suggestions on how to make this work?</p>
