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>