Hi guy

i don't know if the right place to ask but here the question.
I was looking at some code

this one

var pageNum = this.id;
$("#content").load("pagination_data.php?page=" + pageNum, Hide_Load());
});

i would like a link or answer about why they put ?page= at the end of pagination_data.php
i just don't understand what it is for. I don't know much about javascript and php i study at school javascript and teacher never mention about that and doesn't seem to know it...
If you guy could explain to me will be apreciate.Thank you.

Recommended Answers

All 3 Replies

It adds the correct data to the end of the URL that will be used by $_GET (in PHP) on the next page/set of results to display the next set of results.

So if you are on page 1 or results and click on the link to go to page 2, with the code example, the link in the address bar would look like pagination_data.php?page=2 and this tells the script that you want to view page 2 of the results.

So, in short, it is used to send information in the URL to the receiving page which is then accessed using $_GET.

If i understand page= its like a variable that i send to $_GET and get the value??

Maybe i am wrong just correct me.

Yes that is correct and page= is called whatever you want to use as your get value on the next page so as in any variable declarations you can call it what you like.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.