<title>ajax No refresh Add and delete data </title>
<style>
body{
font-size:12px;
}
table{
Border-collaps tutorial E:collapse;
}
</style>
<body>
To show more fluency, we read only the latest 10 data in the database tutorial. Because the number of online testing is much. are operating on a database. Concurrency may occur!
Input: <input id= "str" type= "input"/> <input type= "button" value= "OK Add" onclick= "Add_post ()"/>
<span id= "msg" style= "color:red" ></span>
<table border= "1" ><!--This table is used to display data content-->
<tbody id= "a" ></tbody>
</table>
<span style= "color:red" > Action tip: Click the data you want to delete with your mouse. Then click Delete Button! </span>
<input id= "hid_id" type= "hidden"/>
<input type= "button" value= "delete data" onclick= "Del_data ()"/>
<script type= "text/web Effects" >
function Ajax_xmlhttp () {
Create XMLHttpRequest in IE, suitable for all versions above ie5.0
var msxmlhttp = new Array ("msxml2.xmlhttp.5.0", "msxml2.xmlhttp.4.0", "msxml2.xmlhttp.3.0", "Msxml2.xmlhttp", " Microsoft.XMLHTTP ");
for (var i=0; i<msxmlhttp.length; i++) {
Try
{
_xmlhttp=new ActiveXObject (Msxmlhttp[i]);
}
catch (E)
{
_xmlhttp=null;
}
//loop to create XMLHTTP based on IE browser. end
If not IE browser, create a browser based on Firefox XMLHttpRequest
if (!_xmlhttp && typeof XMLHttpRequest!= "undefined")
{
_xmlhttp=new XMLHttpRequest ();
}
return _xmlhttp;
}