This is why I suggested a framework like JQuery. It makes everything easier, especially loading into dialogs. Here is an example:
In your .js file, write a function like this:
function newDialog(url) {
$("body").append("");
$("#new-dialog").load(url, {},
function(responseText, textStatus, XMLHttpRequest) {
}).dialog( {
height: 680,
width: 840,
draggable :true,
resizable :false,
closeOnEscape: false,
close : function(ev, ui) {
$('#new-dialog').remove();
}
});
}
This creates a div (#new-dialog) on the fly so you have something to populate into. The "url" parameter is the URL for the AJAX call. After it makes the call, the responseText will populate into the #new-dialog dialog. You call it the same way you're doing it now.