Jump to content

[SOLVED] Problem Refreshing AJAX DIV


Axcelcius

Recommended Posts

Here is my code:

var page_current = 0;
var page_request = false;
var page_information = Array();

if(window.XMLHttpRequest){
page_request = new XMLHttpRequest();
}else if (window.ActiveXObject){
try{
	page_request = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
	try{
		page_request = new ActiveXObject("Microsoft.XMLHTTP");
	}catch(e){}
}
}

function process_page(){
page_current = parseInt(page_current);

if(page_information[page_current][5] == 0){
	get_page(1);
}else{
	page_request.open('get', './sources/' + page_information[page_current][5]);
	page_request.onreadystatechange = function(){
		if(page_request.readyState == 4 && page_request.status == 200){
			if(page_request.responseText == 1){
				document.getElementById("page_errors").innerHTML = null;
				get_page(1);
			}else{
				document.getElementById("page_errors").innerHTML = page_request.responseText;
			}
		}
	}
	page_request.send(null);
}
}

function get_page(dir){
page_request.open('get', './sources/' + page_information[page_current][4]);
	page_request.onreadystatechange = function(){
		if(page_request.readyState == 4 && page_request.status == 200){
			document.getElementById("menu_item_" + page_current).className = "process_inactive";
			page_current = page_current + dir;
			document.getElementById("menu_item_" + page_current).className = "process_active";
			document.getElementById("progress").style.width = ((page_current) / page_information.length * 100) + "%";
			document.getElementById("content_header").innerHTML = page_information[page_current][1];
			document.getElementById("page_errors").innerHTML = null;
			document.getElementById("content_layer").innerHTML = page_request.responseText;
			if(page_information[page_current][3] == 0){
				document.getElementById("check_again").className = "hidden";
			}else{
				document.getElementById("check_again").className = "visible";
			}
			document.getElementById("next_button").value = page_information[page_current][2];
		}
	}
page_request.send(null);
}

 

What's supposed to happen is when get_page(0) is called to the div content reloads. The problem is that it does not. I don't have any other problems other than that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.