Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You cannot 'reload a div'. A <code>div</code> is just a single element on an entire webpage, and on its own it has no URL it was loaded from, so it cannot be reloaded. You can set/replace the contents of a div with an Ajax call, but that's definitely not 'reloading' - you'd need to explicitly define the URL to load its new content from.</p> <p>If you want to explicitly replace a <code>div</code>'s contents by loading it from a remote URL, you should use <a href="http://mootools.net/docs/core/Request/Request.HTML" rel="nofollow"><code>Request.HTML</code></a> instead of <code>Request.JSON</code>, and supply the element (or its ID) as the <code>update</code> parameter:</p> <blockquote> <ul> <li>update - (element: defaults to null) The Element to insert the response text of the Request into upon completion of the request.</li> </ul> </blockquote> <p>If you are just looking to replace the contents of an element without remote loading, you can simply do:</p> <pre><code>$('id-of-div').set('text', 'Text to be placed inside the element'); </code></pre> <p>Or:</p> <pre><code>$('id-of-div').set('html', '&lt;p&gt;HTML ending up &lt;em&gt;inside&lt;/em&gt; the div&lt;/p&gt;'); </code></pre> <p>Or build an entire subtree as you did with the <code>new Element</code> call already.</p> <p>As for the secondary question: <code>location.reload()</code> is just shorthand for <code>window.location.reload()</code> so yes, it will reload the entire page (or frame). It can because a window or frame actually <strong>has</strong> a location it was loaded from.</p>
 

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