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
https://forums.phpfreaks.com/topic/75664-solved-problem-refreshing-ajax-div/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.