alex swarz alex swarz - 1 year ago 98
Javascript Question

Jquery on scroll loading is not working (does not update index)

I'm struggling to send an incremented number to my PHP script to load more content. At the moment this script is fully working when I tested, but the number that is incremented by the jQuery when the page is scrolled does not send it to the PHP script. Therefore, the PHP script executes the same content on page scrolling. Could someone help me fix it?

Answer Source

Using jQuery you have sent an ajax post request with the data "getresult". However you have not yet taken this data in your php. Since this code is sent with the key "getresult", in php you can retrieve it by using $_POST["getresult"]

However since this parameter is optional, you can always use a variable like:

$limit = 0;

You can then alter this variable IF the post variable is present

if (isset($_POST["getresult"])) $limit = $_POST["getresult"];

Finally make sure that you use this variable inside the post instead of the 0

mysql_query("select AdName, Photo1name from tbl_name limit ".$limit.",10")

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download