Home > Article > Backend Development > php ajax pagination 1_PHP tutorial
ajax paging php ajax paging java ajax paging asp.net ajax paging jquery ajax paging jsp ajax no refresh paging asp ajax paging ajax paging problem ajax paging ajax jsp paging
ajax paging is used to analyze the data on the client, and then send it to the php file for processing, and return it to the client for processing. The idea is like this .
Three js files and one php file are used here: cookie.js page.js proptype.js result.php file. Let’s look at the contents of each file one by one.
Look at the cookie.js code first:
// JavaScript Document
function SetCookie (name,value,x_expires,x_path,x_domain,x_secure){ //Set a Cookie value function
// alert(name)
var argv = SetCookie.arguments;
//alert(this.argv);
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? x_expires : null;
var path = (argc > 3) ? x_path : null;
var domain = (argc > 4) ? ) ? x_secure : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString() )) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain )) +
((secure == true) ? "; secure" : "");
}
function GetCookie (name) { //Read the cookie value function of the specified name
/ / alert(document.cookie)
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j) ;
i = document.cookie.indexOf(";", i);
if (i == -1) break;
i+=2;
}
return null;
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie .length;
return unescape(document.cookie.substring(offset, endstr));
}
function DeleteCookie (name) { //Delete Cookie value function
var exp = new Date() ;
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp .toGMTString();
}