if you are doing it with javascript like above you still will be loading all the records
you will need to set a mysql limit look at this example
$sql = "SELECT * FROM Orders LIMIT 30";
and then you will need to continue from where you stopped with
$sql = "SELECT * FROM Orders LIMIT 10 OFFSET 15";
have a look at this website
http://www.w3schools.com/php/php_mysql_select_limit.asp