I'm having an issue with my AJAX function, its been working fine then I added another link, and now when i click on an AJAX link on the menu, it tries to load the correct page for a split second and then goes back to the menu page, just can't figure it out!?!It works fine on my local setup but once i moved the new link to the live site its stopped working!???
Code:
<script type="text/javascript" language="javascript">
var loading_img = '/media/images/layout/loading.gif';
var loading_msg = ' Loading...';
var xmlhttp_obj = false;//create the XMLHttpRequest
function ewd_xmlhttp()
{
if (window.XMLHttpRequest)
{ // if Mozilla, Safari etc
xmlhttp_obj = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{ // if IE
try
{
xmlhttp_obj = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp_obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
}
}
}
else
{
xmlhttp_obj = false;
}
return xmlhttp_obj;
} //get content via GET
function getcontent(url, containerid)
{
var xmlhttp_obj = ewd_xmlhttp();
document.getElementById(containerid).innerHTML = '<img src="' + loading_img + '" />' + loading_msg;
xmlhttp_obj.onreadystatechange=function()
{
loadpage(xmlhttp_obj, containerid);
}
xmlhttp_obj.open('GET', url, true);
xmlhttp_obj.send(null);
}
function loadpage(xmlhttp_obj, containerid)
{
if ( xmlhttp_obj.readyState == 4 && xmlhttp_obj.status == 200 )
{
document.getElementById(containerid).innerHTML = xmlhttp_obj.responseText;
}
}
//]]>
</script>