Home >Backend Development >PHP Tutorial >[Original] PHP+ajax implements simulated Win file management system 9_PHP tutorial
//
Original on this site: www.drise.cn
Author:drise1
QQ:271728967
//
Continue from above.
function Senddata(method,url,ReturnValue,Action){ //Save data
xmlhttp.open(method,url,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Cache-Control","no-cache"); //No caching
if(ReturnValue !=null){
xmlhttp.onreadystatechange=ReturnValue;
}
xmlhttp.send(null);
If(Action == 'mkdir') //If you create a folder, refresh the window
{
window.location.reload();
}
}
function ReturnValue(){//return value
if(xmlhttp.readystate != 4 || xmlhttp.status != 200){
document.getElementById("t0").innerHTML="
if( xmlhttp.readystate == 4 || xmlhttp.status == 200 ){
document.getElementById("t0").innerHTML="
setInterval("func()",3000);//Set 3000 seconds delay
}
function func(){
ob=document.getElementById('info');
ob.style.display = 'none';
}
Delete below
function del(obj){
if(confirm("Are you sure you want to delete""+obj+""?","","")){
CreateAjax();
var Delurl="rename.php?path="+encodeURI(obj.replace("/","/"))+"&action=del&rd="+Math.random();
xmlhttp.open("GET",Delurl,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Cache-Control","no-cache");
xmlhttp.onreadystatechange=function(){
If (xmlhttp.readystate == 4 || xmlhttp.status == 200){
var value=xmlhttp.responseText;
If( value =='t' ){
Document.getElementById(obj).style.display="none";
}else if( value =='fo'){
alert("The operation failed, please check the permissions or the folder is not empty! foss!");
}else if( value == "ff"){
alert("Operation failed, please check permissions!");
}else{
alert("The operation failed, please check the permissions or the folder is not empty!!");
}
}
xmlhttp.send(null);
}
}