Jump to content

Migrated to new host. Now my AJAX calls are not working


BobDOORM

Recommended Posts

I run a website with one large library page, containing a huge amount of text files. These are called using AJAX to prevent a HUGE slow loading and hard-to-manage html page. The AJAX script is simple:

 

function ajaxObject(layer,url)

{var that=this;var updating=false;this.callback=function(){}

this.update=function(passData){if(updating==true){return false;}

 

updating=true;var AJAX=null;

if(window.XMLHttpRequest){AJAX=new XMLHttpRequest();}

else{AJAX=new ActiveXObject("Microsoft.XMLHTTP");}

if(AJAX==null)

{alert("Your browser doesn't support AJAX.");return false}

else{AJAX.onreadystatechange=function()

{if(AJAX.readyState==4||AJAX.readyState=="complete")

{LayerID.innerHTML=AJAX.responseText;delete AJAX;updating=false;that.callback();}

}

var timestamp=new Date();

var uri=urlCall+'?'+passData+'&timestamp='+(timestamp*1);

AJAX.open("GET",uri,true);

AJAX.send(null);return true;}

}

var LayerID=document.getElementById(layer);var urlCall='filename.php';

}

function processData(){layerID=document.getElementById('div-ID');data=layerID.innerHTML;

}

 

var liveData01 = new ajaxObject('div-ID');

var liveData02 = new....etc

liveData01.callback = function() { processData(); }

liveData02.callback = function.. etc

 

 

The server side script is 'filename.php' and it consists of only the variable

 

readfile($doc);

 

The document is called using

onclick="liveData01.update('doc=docs/file.txt');return false"

 

$doc  should show the desired txt-file. Somehow I now get the message

 

Warning: readfile() [function.readfile]: Filename cannot be empty in filename.php

 

So somehow the variable is no longer updated with the text file. It has to be a server setting, as it always worked perfectly.

 

All help would be appreciated!!!

 

 

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.