Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does PHP-generated content jitter when loaded trough jQuery, and how do I fix it?
    primarykey
    data
    text
    <p>When I generate PHP within a file that is asynchronously loaded by jQuery, the text seems to jitter or flicker a little while the animation runs. This does not happen to the regular HTML in the requested file, only the content generated with PHP.</p> <p>Just want some hints as to what can end the jitter.</p> <p>Here is the jQuery in the <code>main.php</code>:</p> <pre><code>$(document).ready(function(){ var demo = $('#demo'); demo.hide(); $("button").click(function(){ demo.load('demo.php', function() { demo.show('medium'); }); }); }); </code></pre> <p>Here is the HTML and PHP in <code>demo.php</code>:</p> <pre><code>&lt;p&gt;&lt;?php echo "Hello World with PHP trough AJAX"; ?&gt;&lt;/p&gt; </code></pre> <p>I’m really unsure where to begin. Should I just avoid using PHP in <code>demo.php</code> alltogether? Even so I'd really like to have to possibility to use PHP in scripts called trough AJAX.</p> <p>As per request, here is the whole darn thing: </p> <p><code>main.php</code>:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Testing Ajax&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="main.css" /&gt; &lt;meta charset="utf-8" /&gt; &lt;script type="text/javascript" src="js/jquery-1.9.0.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){ var demo = $('#demo'); demo.hide(); $("button").click(function(){ demo.load('demo.php', function() { demo.show('medium'); }); }); }); &lt;/script&gt; &lt;style type="text/css"&gt; #demo {background-color: MidnightBlue;color: white;padding: 0.1em 1em 1.5em 1.5em;} #demo h1 {color: white;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;section&gt; &lt;article&gt; &lt;h1&gt;Ajax&lt;/h1&gt; &lt;hr /&gt; &lt;button&gt;Load External Content&lt;/button&gt; &lt;div id="demo"&gt;&lt;/div&gt; &lt;/article&gt; &lt;/section&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>(I like MidnightBlue better than CornflowerBlue...)</p> <p><code>demo.php</code>:</p> <pre><code>&lt;h1&gt;Ajax criex Hello World!&lt;/h1&gt; &lt;p&gt;&lt;?php echo "PHP also cries Hello World trough Ajax!"; ?&gt;&lt;/p&gt; </code></pre>
    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.
    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