views:

832

answers:

3

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 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?

+2  A: 

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

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

$()
Ben
if ready is already fired, a call to $(function() {}) will fire immediately
CVertex
A: 

Use the livequery plugin.

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

Bopp