Search code examples
javascriptjqueryjquery-uijquery-ui-dialogjquery-ui-plugins

using load() to load page that also uses jQuery


I'm trying to load a page that is basically an edit form inside a dialog (ui.dialog). I can load this page fine from an external (I'm using asp.net) page.

The problem is that inside of my "popup" form, I need to $(function() {my function here}); syntax to do some stuff when the page loads, along with registering some .fn extensions for some dynamic dropdowns using ajax calls.

I have created my <script type="text/javascript" src="jquery.js"> but I don't think these are being included, and also my $(function) is not being called.

Is this possible to do or do I need to find another way of accomplishing what I need to do?


Solution

  • If you really need to load that form via AJAX you could to do all the Javascript stuff in $.ajax callback itself. So, you load the popup form like this:

    $.ajax({
       //...
       success: function(text) {
           // insert text into container
           // the code from $(function() {});
       }
    });