目前只能同一个文件夹的啊~
var xmlhttp;
if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200){
if(xmlhttp.responseText==1){
document.getElementById("myForm").submit();
}
else{
document.getElementById("login_note_area").innerHTML="帐号或密码不对";
}
}
};
var array=document.getElementById("id").value.toString();//id
array+=":";
array+=document.getElementById("password").value.toString();//密码
xmlhttp.open("POST","login.php?q="+array,true);
xmlhttp.send();
login.php和js在不同文件夹怎么访问啊
在ajax里面设置url地址嘛
楼主的意思是一个页面对应多个js,这多个js文件里的数据实现互相访问?
自己看下路径怎么定义的。。修改路径就好了
http://www.jb51.net/web/14536.html
login.js在Xl_Blog/inc/js/内 login.php在Xl_Blog/inc/php内,而页面在Xl_Blog/manage内!
在页面中引入js文件,在js文件中写ajax,
url这一行:xmlhttp.open("POST","../inc/login.php?q="+array,true);这样写ajax太麻烦,建议你使用jquery