JS发送http请求(get方式)

var url = "http://192.168.2.234:8080/GS1014J_MCF/forumServer?"

+ "queryMode=byId&forumId=297e254c60114cd301601186c0740009";

var time = 1000;

var timeout = false;

var request = new XMLHttpRequest();

var timer = setTimeout(function() {

timeout = true;

request.abort();

}, time);

request.open("GET", url);

request.onreadystatechange = function() {

if (request.readyState !== 4) {

return;

}

if (timeout) {

dorado.MessageBox.alert("out");

return;

}

clearTimeout(timer);

if (request.status === 200) {

callback(request.responseText);

}

};

request.send( null );

你可能感兴趣的:(Java)