Ajax +php No Refresh page code we are here to use PHP+JS+AJAX implementation of data without refreshing page code OH.
Ajax +php Tutorial No Refresh paging code
We are here to use php+ web effects +ajax Implementation of data without refreshing page code OH.
*/
index.php file
Header ("content-type:text/html; Charset=utf-8 ");
Error_reporting (E_all^e_notice);
Include (' pagination_class.php ');
MySQL tutorial _connect (' localhost ', ' root ', ') or Die (Mysql_error ());
mysql_select_db (' Mydemo ');
mysql_query ("Set names ' UTF8 '");
?>
$qry = "SELECT * from students";
$searchtext = "";
if ($_request[' Search_text ']!= "") {
$searchtext = $_request[' Search_text ');
$qry. = "WHERE name like ' $searchtext% '";
}
for pagination
$starting = 0;
$recpage = 2;//number of records per page
$obj = new Pagination_class ($qry, $starting, $recpage);
$result = $obj->result;
?>
Pagination.js file
function $ ()
{
var elements = new Array ();
for (var i = 0; i < arguments.length; i++)
{
var element = Arguments[i];
if (typeof element = = ' String ')
element = document.getElementById (element);
if (arguments.length = = 1)
return element;
Elements.push (Element);
}
return elements;
}
var xmlhttp
function pagination (page)
{
Xmlhttp=getxmlhttpobject ();
if (xmlhttp==null)
{
Alert ("Your browser does not support ajax!");
Return
}
var url= "test_sub.php";
url = url+ "? starting=" +page;
url = url+ "&search_text=" +$ (' Search_text '). Value;
url=url+ "&sid=" +math.random ();
xmlhttp.onreadystatechange=statechanged;
Xmlhttp.open ("Get", url,true);
Xmlhttp.send (NULL);
}
function statechanged ()
{
if (xmlhttp.readystate==4)
{
$ ("page_contents"). Innerhtml=xmlhttp.responsetext;
}
}
function Getxmlhttpobject ()
{
var xmlhttp=null;
Try
{
Firefox, Opera 8.0+, Safari
Xmlhttp=new XMLHttpRequest ();
}
catch (E)
{
Internet Explorer
Try
{
Xmlhttp=new ActiveXObject ("msxml2.xmlhttp");
}
catch (E)
{
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
}
}
return XMLHTTP;
}
1 2
http://www.bkjia.com/PHPjc/630203.html www.bkjia.com true http://www.bkjia.com/PHPjc/630203.html techarticle Ajax +php No Refresh page code we are here to use PHP+JS+AJAX implementation of data without refreshing page code OH. Ajax +php Tutorial No Refresh page code we are here to use php+ web effects +ajax real ...