Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>PHP is a preprocessor. So, it doesn't matter that you are including it 'later' in the file. Your include_once will be processed and output before the JavaScript is executed. </p> <p>I looks like the problem is that your include_once script is also outputting the container div. So, when you remove that line it breaks the javascript. Try this instead:</p> <ol> <li>Remove the container div from you maxresults.php file.</li> <li>Replace the <code>&lt;?php include_once('functions/maxresults.php);&gt;</code> with an empty div with an id of container: <code>&lt;div id="container"&gt;&lt;/div&gt;</code></li> </ol> <p>Your JavaScript should work now:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $.ajax({ url: 'functions/maxresults.php', type: 'GET', data: {h: screen.height, w: screen.width} }).done(function(resp) { alert("I am working!"); $("#container").html(resp); }); }); &lt;/script&gt; </code></pre> <p><strong>And further down</strong></p> <pre><code>&lt;div =id="container"&gt;&lt;/div&gt; </code></pre> <p><strong>maxresults.php</strong></p> <pre><code>&lt;?php require_once("databasefunctions.php"); ?&gt; &lt;div id="movieinfo"&gt; &lt;?php include("sidebar.php");?&gt; &lt;?php // get the function include_once ('function.php'); if($_GET['page']) $page = $_GET['page']; else $page = 0; $maxresults = -1; if(($_GET['w']) &amp;&amp; ($_GET['h'])) { $w = $_GET['w']; $h = $_GET['h']; } if ($w == 1920) { $maxresults = 24; } else if ($w == 1600) { $maxresults = 21; } else if ($w == 1440){ $maxresults = 14; } else if ($w == 1366) { $maxresults = 21; } else if ($w == 1024) { $maxresults = 8; } else $maxresults = 6; echo $maxresults; $currentpage = $page; $page = $page*$maxresults; $numpages = QuickQuery("SELECT COUNT(id) FROM movies WHERE visible=1"); $numpages = mysql_result($numpages, 0); $numpages = $numpages/$maxresults-1; $result = GetMoviesByRangeID($page, $maxresults);//Show &lt;maxresults&gt; pages at a time DisplayResults($result); ?&gt; &lt;/div&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.
    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