1
I'm trying to build a template using Javascript's XMLHTTPRequest object to pull module data without refreshing the entire page.
The code seems to work on most pages, but I'm having a problem with the new_bb/viewforum.php. Every time I click a button that calls data from that page, I am redirected to the actual page instead of the data appearing on the start page.
I am using the alert() function to display the data before it's incorporated into the page, but the forum data always shows up blank, then redirects.
The code works on the index page of the site, other modules and other pages of the forum module, but that one page is constantly redirecting and I can't figure out why.
Is there something in the viewforum.php file that causes a refresh or redirect when a request comes in?
Here's the portion of Javascript code that calls the data and attaches it to the current window:
this.load = function(string) {
//string is the url to pull from
if (string.indexOf('?') != -1){
string += '&ajax=true';
} else {
string += '?ajax=true';
}
self.http.open('get', string);
self.http.onreadystatechange = handleData;
self.http.send(null);
self.pagelink = string;
}
function handleData() {
if (self.http.readyState == 4) {
//self.element is the element
self.element.innerHTML = self.http.responseText;
}
}