SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question AJAX: Page cannot be found - please help :)

    ello all,

    I'm working on a page that pulls data via AJAX.
    I've done it before like this, it has always worked fine, but for some reason this time it returns a "The page cannot be found" error.

    I have also tried to paste getAuthentication.asp into the same directory as getAuthentication.js and adjust the pathing, but to no avail.

    Can anyone please help me with this?

    Thanks in advance!
    V

    Code:
    var xmlHttp=null;
    var s_pwdByResponse="";
    
    function getAuthentication()
    {
    	var s_user, s_pwd, s_encryptedPwd, s_aspPage;
    	s_user = document.getElementById("txt_user").value;
    	s_pwd = document.getElementById("txt_pwd").value;
    	s_aspPage = "../asp/getAuthentication.asp";
    	
    	s_encryptedPwd = encryptPwd(s_pwd);
    	
    	xmlHttp = getHttpObject();
    	xmlHttp.onreadystatechange = getPassword;
    	// This is what's going wrong methinks... But what is it???
    	xmlHttp.open("GET",s_aspPage,false);
    	xmlHttp.send(null);
    
    	// These 2 lines are for testing purposes only
    	document.getElementById("response").innerHTML+=s_pwd + "<br />" + s_encryptedPwd + "<br />";
    	// Pastes the response to the page in a Paragraph tag
    	document.getElementById("response").innerHTML+=s_pwdByResponse;
    	if(s_pwd == s_pwdByResponse) alert("correct password");
    	else if(s_pwdByResponse == "No records returned.") alert("User not found in userdatabase.");
    	else alert(s_pwd + "\r\nIs an incorrect password");
    }
    
    function getHttpObject()
    {
    	var xmlHttpToReturn = null;
    	
    	try{ xmlHttpToReturn = new ActiveXObject("Msxml2.XMLHTTP"); }
    	catch (e)
    	{
    		try{ xmlHttpToReturn = new ActiveXObject("Microsoft.XMLHTTP"); }
    		catch (e){ xmlHttpToReturn = new XMLHttpRequest(); }
    	}
    	
    	return xmlHttpToReturn;
    }

  2. #2
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Erf, nevermind 0:-) I figured it out ghe ghe, the pathing is based on the page, not on the scriptfile's location...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •