It is necessary to output data to the page through ajax (HTML). The data is generated in a loop in a PHP file. That's what I do.
Javascript
$(".nameClass").load( // Скрипт начинает работу сразу после загрузки страницы "dannie.php", { param: "znach" }, function () {});
Php
$param = $_POST['param']; require_once 'connect.php'; // Соединяюсь с БД $zap = mysql_query('SELECT name FROM table ORDER BY '.$param); while ($mass = mysql_fetch_array($zap)){ echo "<br/> "; echo "<div>".$mass['name']."</div>"; }
Errors do not give any js or php. If output without ajax, everything works fine. And it is necessary through ajax.