Sorry for unclear title but I couldn't find anything that could suit my problem.To better explain what it is let me show you my javascript code:
function askForIDForCommand()
{
var content;
$.post("Somepage.aspx", function (data)
{
content = $(data).find("#myDiv").html();
});
var myFunc = function () { }
var buttons = [{ text: 'OK', click: myFunc}];
ui_window("Hi", 630, content, buttons);
}
As you can see I declare a variable called content. Then I assign the html of a specified div to it. And then I send it to ui_window function which just displays a jquery dialog with the specified content. The problem is I don't get that html content in the dialog. When I look up the value of "content" with Firebug I can see that it contains html content. What makes me desperate is if I change the above function to the below one the html content gets displayed in the dialog:
function askForIDForCommand()
{
var content;
$.post("Somepage.aspx", function (data)
{
content = $(data).find("#myDiv").html();
var myFunc = function () { }
var buttons = [{ text: 'OK', click: myFunc}];
ui_window("Hi", 630, content, buttons);
});
}
In case you can't notice the difference, I just put the call of ui_window inside the $.post() method. And it works. Why's that?
And here's the html content in case you need it:
<table>
<tr>
<td align="right">
<label>
Enter the ID:</label>
</td>
<td>
<input id="txtID" type="text" onkeydown="return onlyNumbers(event);" maxlength="8"/>
</td>
</tr>
</table>