bioshock
New Member
- Messages
- 27
- Reaction score
- 0
- Points
- 0
why this javascript doesn't work. Just shows an empty dialog box
the pkg.html retruns some plain text
i am really noob in javascript please help
the pkg.html retruns some plain text
Code:
function get_data(url)
{
var http = new XMLHttpRequest() ;
var result = "";
http.open("GET", url, true);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 || http.readyState == "complete") {
result=http.responseText;
}
}
http.send(null);
return result;
}
/*]]>*/
var result = "";
result=get_data("pkg.html")
alert(result);