一开始我是准备使用post进行ajax进行异步操作
xhr=new XMLHttpRequest(); xhr.open('post','m.php',true); xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xhr.send('date='+cdate); //cdate是获取的日期值
但是服务器的中$_POST['date']却显示为空,请问这是为什么呢?
最后是换成了GET方法成功获取数据
xhr.open('get','m.php?date='+cdate,true); //cdate是获取的日期值xhr.send();
杨魅力
相关分类