Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax call to file with <script> tags
    primarykey
    data
    text
    <p>So I have a sample page that works to replicate table layout pages without using the very mobile-unfriendly table features.</p> <p>Basically I have a page that looks like so:</p> <pre><code>&lt;html&gt; ... &lt;body&gt; &lt;div type="page"&gt; &lt;div class="header"&gt; &lt;/div&gt; &lt;!-- /header --&gt; &lt;div class="body"&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $(".header").load("/common/header.html"); $(".body").load("/Example/example-home.html"); //Call to superclass function to replace contents after load }); /*$(document).ready(function() { $.ajax({ url: "/Example/example-home.html", }).done(function (data) { $(".body").append(data); }); });*/ &lt;/script&gt; --&gt; &lt;/div&gt; &lt;!-- /body --&gt; &lt;/div class="footer"&gt; &lt;/div&gt; &lt;!-- /footer --&gt; &lt;/div&gt; &lt;!-- /page --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The file that is being called via ajax looks like:</p> <pre><code> &lt;style&gt; /* Various CSS Stylings */ &lt;/style&gt; &lt;script type="text/javascript"&gt; /*Populate our scripts upon ajax request var sList[0] = ["Color Mutate", "Versatile, Schemebale, string mutation script. Format your text in any color scheme you can dream.", "1.2.0"]; $(document).ready(function() { if (!sList) { $(".table").html("&lt;p&gt;No hosted scripts found&lt;/p&gt;"); } else { for (var i = 0;i&lt;=sList.length;i++) { $(".script").append(sList[i][0]); $(".desc").append(sList[i][1]); $(".version").append(sList[i][2]); } } }); */ // moved to main.js &lt;/script&gt; &lt;div class="table"&gt; &lt;div class="script"&gt; &lt;/div&gt; &lt;div class="desc"&gt; &lt;/div&gt; &lt;div class="version"&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- /table --&gt; </code></pre> <p>And the ajax call is successful when viewed in firebug, the resulting output looks identical to the example-home.html file, but the browser shows nothing in the <code>&lt;div class="body"&gt;&lt;/div&gt;</code> section afterwards.</p> <p>I fear it's an issue with the asynchronous nature of ajax calls, but cannot seem to figure out a viable solution.</p> <p><strong>EDIT</strong> I have also tried doing <code>$(this).append()</code> instead of the <code>$(".body").append()</code> as shown above to no avail as well.</p> <p><strong>EDIT 2</strong> Updated to working code</p>
    singulars
    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