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!!!

 

 

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.