View Full Version : Ajax Pagenav not working on IE but works in FF

12-04-2008, 06:57 AM
Hi Guys

I am really stumped here. I have a piece of inhereted code that does a pagenav (forward back page 1, 2, 3, show 5, 10, 20 records etc) via ajax. As far as I can gather, this is a virtuemart page navigation tool that another developer copied and stuck into a joomla frontend tool. The class, if anyone is familiar with it is virtuemart's ajaxPageNavigation.php (Just for your information)

This is the offending javascript:

var xmlHttp;
var id;

function submitAjax() {


function showDataInput(gtask, cmid, new_id, luid) {

id = 'cellar_sales_history';
if ( new_id != undefined ) {
id = new_id;
var ls = document.adminForm.limitstart.value;
var lim = document.adminForm.limit.value;
var url = document.adminForm.siteurl.value;
var iam = document.adminForm.iam.value;
var from = document.adminForm.from.value;
var to = document.adminForm.to.value;
var url = url + "/administrator/components/com_virtuemart/classes/report.cellar_sales_history_process.php?&option=com_virtuemart&page=admin.user_form&gtask="
+ gtask + "&limit=" + lim + "&limitstart=" + ls + "&iam=" + iam + "&from=" + from + "&to=" + to + "&url=" + url;
xmlHttp = GetXmlHttpObject(stateChanged);
xmlHttp.open("GET", url , true);

function stateChanged() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
document.getElementById(id).innerHTML=xmlHttp.responseText ;

function GetXmlHttpObject(handler) {
var objXmlHttp=null;
if (navigator.userAgent.indexOf("Opera")>=0) {
alert("This example doesn't work in Opera") ;
return ;
if (navigator.userAgent.indexOf("MSIE")>=0) {
var strName="Msxml2.XMLHTTP";
if (navigator.appVersion.indexOf("MSIE 5.5")>=0) {
} try {
objXmlHttp=new ActiveXObject(strName);
objXmlHttp.onreadystatechange=handler ;
return objXmlHttp;
} catch(e) {
alert("Error. Scripting for ActiveX might be disabled");
if (navigator.userAgent.indexOf("Mozilla")>=0) {
objXmlHttp=new XMLHttpRequest();
return objXmlHttp;

The problem is that document.adminForm.siteurl.value is not getting sent in IE. I get "document.adminForm.siteurl.value is null or not an object" in ie's javascript box, when I use any of the page navigation functions.

Now, I have read that IE does not "re-initialize" the xmlhttp object on the second iteration, but I cannot fix it, I just do not know enough about Ajax.

It works fine in FF.

I have tried implementing some other fixes found here and other places, but I keep breaking it. Could anyone please show me how to get around this issue in realtion to the above code?

Thanks in advance for your help.