Question

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?

Was it helpful?

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() {});
   }
});

OTHER TIPS

The script isn't getting run because the document's ready event has already been fired. Remove your code from within the

$()

Use the livequery plugin.

It allows you to bind events to elements that might be loaded later: http://brandonaaron.net/docs/livequery/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top