一、GET请求
#FBrowser浏览器测试 可用 function TestA(url){ var req = new XMLHttpRequest(); req.open('GET', url, false); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //设置协议头 req.send(); return req.responseText } TestA('https://lumtest.com/myip.json');
二、POST请求
#FBrowser浏览器测试 可用 function URL_POST(url){ var req = new XMLHttpRequest(); req.open('POST', url, false); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //设置协议头 req.send("locationType=LOCATION_INPUT&zipCode=10021&storeContext=generic&deviceType=web&pageType=Gateway&actionSource=glow"); return req.responseText } URL_POST('http://lumtest.com/myip.json');
发表回复
评论列表(1条)
收藏了,后续肯定能用的上