php ajax

<script type="text/javascript" src=‘<?=$rootUrl?>/js/jquery.min.js‘></script>
<script type="text/javascript">
//ajax获取bins
var xmlHttp;
function cthis(v){
$("#bin_id option").remove();
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
//需要进行Ajax的URL地址
var url =encodeURI( "admin/system_bin_getBin.php?sid="+v+"&type=‘getselectbin‘");
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var xmlarray=xmlHttp.responseText.split("&");

for(var i=0;i<xmlarray.length-1;i++)
{
var bin_id_name=xmlarray[i].split("|");
$("#bin_id").append("<option value=‘"+bin_id_name[0]+"‘>"+bin_id_name[1]+"</option>");
}
}
}

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;
}
</script>

php ajax,布布扣,bubuko.com

php ajax

上一篇:Web---演示Servlet的相关类、表单多参数接收、文件上传简单入门


下一篇:基于阿里云的 Node.js 稳定性实践