function getbtn() {
console.log("1213")
//通過ajax異步請求請求服務器
//new一個對象出來
xmlHttpRequest = new XMLHttpRequest();
//設置對象的回調函數,即ajax獲取數據後,需要進行的操作
xmlHttpRequest.onreadystatechange = callBack;
//填寫對象方法,URL,是否爲異步
xmlHttpRequest.open("get", "http://patent/public/index.php/api/market.patent/detail?id=1", true);
//設置GET的頭部信息
xmlHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
//發送請求
xmlHttpRequest.send();
}
//回調函數
function callBack() {
if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) {
console.log(xmlHttpRequest.responseText)
} else {
}
}