Jump to content

pathway problem


lilman

Recommended Posts

Here is my file structure.

 

root

(folder) styles/ (includes: header, footer)

(folder) mysettings

            (file) index.php

            (file) body.html

            (folder) subscreens/

                      (file) profile.html

                      (file) settings.html

 

Now when you go to the folder mysettings, index.php calls the header and footer. It also calls body.html which calls the file settings.html in the subscreens folder. Now in the subscreens folder you have 2 files which I want to call using Ajax. the JavaScript required is typed in the header located in the styles folder. Here is that code:

 

<script type="text/javascript">
<!--
//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp = false;
//Check if we are using IE.
try 
{
//If the Javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e) 
{
//If not, then use the older active x object.
try 
{
	//If we are using Internet Explorer.
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E)
{
	//Else we must be using a non-IE browser.
	xmlhttp = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
{
xmlhttp = new XMLHttpRequest();
}

function makerequest(serverPage, objID) 
{
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
{
	obj.innerHTML = xmlhttp.responseText;
}
if (xmlhttp.status==200) alert("URL Exists!")
    else if(xmlhttp.status==404) 
    {
    
    alert("URL doesn't exist!");
    }
}
xmlhttp.send(null);
}
//-->
</script>

 

Then the hyper link which triggers the JavaScript is in the subscreens files. Here is the hyper link:

onClick="makerequest('settings.html','content');

 

When I run it, I get URL doesn't exist! So if anyone could help me, I think the problem is my file path but I have tried so many different ways, but cannot seem to get the right path.

 

Thank you.

 

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.