<!DOCTYPE html>
title here ajax
a
<br> function show(){<br> CreateXmlHttp();<br> if(!xhr){<br> alert("创建xmlhttp对象异常");<br> return false;<br> }<br> xhr.open("POST", "<a href="https://aip.baidubce.com/oauth/2.0/token%22">https://aip.baidubce.com/oauth/2.0/token"</a>);<br> xhr.setRequestHeader("Access-Control-Allow-Origin", "*");<br> xhr.onreadystatechange = function () {<br> if(xhr.readyState == 4){<br> document.getElementById("dd").innerHTML = "数据正在加载。。。"+xhr.status;<br> if(xhr.status == 200){<br> document.getElementById("write").innerHTML = xhr.responseText;<br> }else{<br> document.getElementById("write").innerHTML = "不能够进行跨域请求。";<br> }<br> }<br> }</p> <pre><code> xhr.send('grant_type=client_credentials&client_id=mfnwFRuO5EOewQON0piojoNR&client_secret=3aDW6TU1nZ7mDsAx5zjvz75WPVyx6LeG'); } function CreateXmlHttp(){ //非IE浏览器创建XmlHttpRequest对象 if(window.XMLHttpRequest){ xhr = new XMLHttpRequest(); } //IE浏览器创建XmlHttpRequest对象 if(window.ActiveXObject){ try{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ try{ xhr = new ActiveXObject("msxml2.XMLHTTP"); }catch(ex){ } } } } </script> </body> </code></pre> <p></html></p> <p>这是代码,大神门看一看怎么改浏览器就都能访问啦,手机上也需要能访问,现在只有IE浏览器能访问</p>