Jump to content

ajax div loading working on wamp not working on server


sarahAria

Recommended Posts

hi guys I have an ajax site on hamednet.ir that uses ajax to change content of a div file

but now when I uploaded it to server(direct admin) it don't work!!

I already have used a similar version on other hosts with cpanel then it works

I changed some permissions but no chance of success.

 

// here we define global variable
var ajaxdestination="";

function getdata(what,where) { // get data from source (what)
try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) { /* do nothing */ }

document.getElementById(where).innerHTML ="<center><img src='img/loading.gif'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
ajaxdestination=where;
xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
xmlhttp.open("GET", what);
xmlhttp.send(null);
  return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) 
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}

 

 

<a href="#" onclick="getdata('change.html','paragraph');">

 

you can see full code on my site hemdnet.ir

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.