jQuery ajax load page with external page attached
<p>I have a jQuery function that loads a page into a div when an element is clicked. Like this:</p>

<pre><code>$("#viewID").change(function(){     

            $.ajax({
                type: "POST",
                url:"advOptions_lv.cfm",
                data: {viewID: $(this).val()},
                success: function(data){
                    $("#dataView").html(data);

                }
            });


    });
</code></pre>

<p>The page that I am loading requires some JS code that is in another external file called <code>advOptions.js</code>. I have tried just loading that external js page in the original page but the jQuery calls will not work. So I added it to the <code>advOptions_lv.cfm</code> page. When I do that I see a get call to it in firebug every time the <code>viewID</code> element is clicked and the page is loaded.</p>

<p>My problem is that in the <code>advOptions.js</code> file has a basic ajax form submit function like this <code>$.post('saveView.cfm', $("#newDataViewForm").serialize() ,function(data){ });</code>. This is getting fired off multiple times. It all depends on how many times the external page is loaded.</p>

<p>My question is, is that the best way to get the external js page to work with the page that is getting loaded using the jQuery ajax call? If not how should I be doing this?</p>

<p>Any help on this would be great.</p>

<p>Thanks</p>
