Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript doesn't work after document.write
    primarykey
    data
    text
    <p>I am using jQuery BlockUI for opening a new webpage that takes some time due to a lot of database querying with the following javascript:</p> <pre><code>function productSheet(url2) { $.blockUI.defaults.overlayCSS = {}; $.blockUI({ }); $.ajax({ url: url2, success: function (respones) { var win = window.open(); with (win.document) { open(); write(respones); close(); } } }); }; </code></pre> <p>At the new page i got some jQuery JavaScript and a reference to the external jQuery script. However when i render the page after the JavaScript above all my script throws error for: "$ undefined". I can refresh the page and everything starts working and I am not getting any script errors.</p> <p>This problem only occur when I am debugging in IE 9, on Firefox everything works (no JavaScript errors and the script works). </p> <p>Does anyone have any idea on whats the problem can be?</p> <p>EDIT:</p> <p>The page iam rendering is a MVC 3 view. So the script above goes to an MVC action that returns a this view:</p> <pre><code>@model WebApplication.Controllers.ProductSheetModel &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Sheet - @Model.ArticleMain.ArticleMain.T0018_BENAM&lt;/title&gt; &lt;script src="../../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link href="../../css/ProductSheet.css" rel="stylesheet" type="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrapper"&gt; @if (Model.IsPDFExport == false) { @Html.DisplayFor(model =&gt; model.ArticleMain, "ProductSheetHeader") } ... some more partical views... &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { var tabelheight1 = $("#divNutritiveValues").height(); var tabelheight2 = $("#divMarking").height(); if (tabelheight1 &gt; tabelheight2) { $("#divMarking").css("height", tabelheight1 + "px"); $("#divNutritiveValues").css("height", tabelheight1 + "px"); } if (tabelheight2 &gt; tabelheight1) { $("#divNutritiveValues").css("height", tabelheight2 + "px"); $("#divMarking").css("height", tabelheight2 + "px"); } var tableheightStore = $("#divStore").height(); var tableheightCooking = $("#divCooking").height(); if (tableheightCooking &gt; tableheightStore) { $("#divCooking").css("height", tableheightCooking + "px"); $("#divStore").css("height", tableheightCooking + "px"); } if (tableheightStore &gt; tableheightCooking) { $("#divCooking").css("height", tableheightStore + "px"); $("#divStore").css("height", tableheightStore + "px"); } var tableInfoProvid = $("#divInformationProvider").height(); var tableManufac = $("#divManufacturer").height() if (tableInfoProvid &gt; tableManufac) { $("#divManufacturer").css("height", tableInfoProvid + "px"); $("#divInformationProvider").css("height", tableInfoProvid + "px"); } if (tableManufac &gt; tableInfoProvid) { $("#divInformationProvider").css("height", tableManufac + "px"); $("#divManufacturer").css("height", tableManufac + "px"); } }); </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload