Php ajax paging
1.
[File]SQL. SQL
CREATE TABLE `tb_user` ( `id` int(10) NOT NULL auto_increment, `username` varchar(50) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;INSERT INTO `tb_user` VALUES (1, 'aaa');INSERT INTO `tb_user` VALUES (2, 'bbb');INSERT INTO `tb_user` VALUES (3, 'ccc');INSERT INTO `tb_user` VALUES (4, 'ddd');INSERT INTO `tb_user` VALUES (5, 'eee');INSERT INTO `tb_user` VALUES (6, 'fff');INSERT INTO `tb_user` VALUES (7, 'ggg');INSERT INTO `tb_user` VALUES (8, 'hhh');INSERT INTO `tb_user` VALUES (9, 'жпнд');
2.
[File]Ajaxpage. js
Var http_request = false; function send_request (url) {// initialization, specifies the processing function, and the request sending function http_request = false; // starts to initialize the XMLHttpRequest object if (window. XMLHttpRequest) {// Mozilla http_request = new XMLHttpRequest (); if (http_request.overrideMimeType) {// Set the MIME category http_request.overrideMimeType ("text/xml");} else if (window. activeXObject) {// IE browser try {http_request = new ActiveXObject ("Msxml2.XMLHttp");} catch (e) {try {http_reque St = new ActiveXobject ("Microsoft. XMLHttp");} catch (e) {}} if (! Http_request) {// exception. failed to create the object instance window. alert ("failed to create the XMLHttp object! "); Return false;} http_request.onreadystatechange = processrequest; // Determine the request sending method, URL, and whether to synchronously execute the following code http_request.open (" GET ", url, true ); http_request.send (null);} // function processrequest () {if (http_request.readyState = 4) {// judge the object status if (http_request.status = 200) {// The information has been returned successfully. start to process the information document. getElementById (reobj ). innerHTML = http_request.responseText;} else {// The page is not normal alert ("the page you requested is not normal! ") ;}} Function dopage (obj, url) {document. getElementById (obj ). innerHTML = "reading data... "; reobj = obj; send_request (url );}
3.
[Code][PHP] code
PHP + ajax paging demonstration