私はこのJavaScriptを持っています:
function createRequestObject(){
var req;
if(window.XMLHttpRequest){
//For Firefox, Safari, Opera
req = new XMLHttpRequest();
}
else if(window.ActiveXObject){
//For IE 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
//Error for an old browser
alert('Your browser is not IE 5 or higher, or Firefox or Safari or Opera');
}
//alert (req);
return req;
}
//Make the XMLHttpRequest Object
var http = createRequestObject();
function sendRequestTwo(method, url, head1){
head = head1
if(method == "get" || method == "GET"){
http.open(method,url);
http.onreadystatechange = handleResponseTwo;
http.send(null);
}
}
var head; //divs name
function handleResponseTwo(){
if(http.readyState == 4 && http.status == 200){
var response = http.responseText;
if(response){
document.getElementById(head).innerHTML = response;
}
}
}
この部分
document.getElementById(head).innerHTML = response;
結果をマイページに貼り付けます。ページが完全に読み込まれる前に「読み込み中」と表示するにはどうすればよいですか?