Why can’t I put dynamic text on a div called foo? The following is on a metho in the asp.net codebehind.
StringBuilder script = new StringBuilder();
script.Append("<script type='text/javascript'>");
script.Append(" $(document).ready(function () {");
script.Append(" $('<div id=foo></div>').appendTo('body');");
script.Append(" var dlg = $('#foo');");
script.Append(" dlg.dialog({");
script.Append(" autoOpen: true,");
script.Append(" resizable: false,");
script.Append(" draggable: false,");
script.Append(" modal: true,");
script.Append(" title: 'Información',");
script.Append(" width: 400,");
script.Append(" height: 200,");
script.Append(" buttons: {");
script.Append(" 'Cerrar': function () {");
script.Append(" $(this).dialog('close');");
script.Append(" }");
script.Append(" }");
script.Append(" });");
script.Append(" $('#foo').html(<p>"+info+"</p>);");
script.Append(" });");
script.Append("</script>");
ClientScript.RegisterStartupScript(this.GetType(), "launchModalWindow", script.ToString());
The problem is in this line:
script.Append(" $('#foo').html(<p>"+info+"</p>);");
Put the dynamic text like that: