BobDOORM Posted May 20, 2012 Share Posted May 20, 2012 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+'×tamp='+(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!!! Quote Link to comment https://forums.phpfreaks.com/topic/262834-migrated-to-new-host-now-my-ajax-calls-are-not-working/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.