Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like your last HEREDOC (that's what the <code>&lt;&lt;&lt;</code> syntax is called) is unclosed, missing it's</p> <pre><code>HTML; </code></pre> <p>And don't forget that the final <code>HTML;</code> cannot have <em>any</em> whitespace on the same line before or after it.</p> <p>However, you're going about it all wrong. The great thing about the HEREDOC syntax is that you can embed all your variables into it without requiring any concatenation. Just create the whole thing in one HEREDOC and echo it out to jQuery. There's no need to make it JSON if you are just going to use it as HTML when received by the AJAX call.</p> <p>All your code above belongs inside one <code>$html = &lt;&lt;&lt;HTML</code> block. Enclose all your complex variables like <code>$_SESSION['whatever']</code> in <code>{}</code> <code>{$_SESSION['whatever']}</code>.</p> <pre><code>$html = &lt;&lt;&lt;HTML &lt;div class="box"&gt; &lt;h2&gt; &lt;a href="#" id="remove"&gt;{$text[0]}&lt;/a&gt; &lt;/h2&gt; &lt;div class="block"&gt; &lt;div style="float:left; width: 35%; margin:5px; padding: 1em; background: white;"&gt; &lt;p&gt;Username: &lt;a id="username"&gt; {$_SESSION['username']}&lt;/a&gt;&lt;/p&gt; &lt;div style="float:left; width: 30%; margin:5px;"&gt; &lt;p&gt; Level:&lt;br /&gt; Weapon:&lt;br /&gt; Power:&lt;br /&gt; Bullets:&lt;br /&gt; &lt;/p&gt; &lt;/div&gt; &lt;div style="float:right; width: 60%; margin:5px;"&gt; &lt;p&gt; &lt;b id="level"&gt;empty&lt;/b&gt;&lt;br/&gt; &lt;!--etc --&gt; &lt;!--etc --&gt; HTML; // Now just echo it back to the AJAX caller as HTML echo $html; exit(); </code></pre>
 

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