I think that you want to send an ajax request to the stackoverflow.com website.
Unless you are one of the devs for stackoverflow.com you cannot send ajax requests to their website.
That is called cross-domain scripting and generally it is not allowed. There is a way to allow it, but the other website (stackoverflow.com) has to allow it specifically by putting something like this in PHP:
header('Access-Control-Allow-Origin: http://your-domain.com');
I could be wrong, but I do not believe stackoverflow.com allows this.
So, to do your testing, you must create a second page on your own server that will respond to the ajax requests.
The below post has some simple ajax examples that you can try on your own server:
AJAX request callback using jQuery
Note: There is a way to send button presses to the other side without using cross-domain scripting. You can use either a Firefox add-in called GreaseMonkey or a Chrome add-in called TamperMonkey to inject javascript into the page that will do almost anything you want. You cannot use these add-ins to send AJAX and receive back responses, but at least you can press a button on the page. In fact, you can add your own buttons to the page and attach javascript code to those new buttons that can change the appearance of the page, or press buttons on the page, etc.
Re-reading your question and your comments, I now understand that what you are asking about. It is called "PHP pagination", and it uses a combination of PHP and javascript (but mostly PHP) to work. Here are some links that will help:
http://www.phpfreaks.com/tutorial/basic-pagination
https://www.tutorialspoint.com/php/mysql_paging_php.htm
https://code.tutsplus.com/tutorials/how-to-paginate-data-with-php--net-2928
http://www.youthinterest.com/2013/03/11/dynamic-pagination/