Jump to content

Ajax Not Showing Proper Result


tijger0407

Recommended Posts

I shall start with the code of the page This is the page where you start from and the AJAX results should be shownThis is the kind of link you will see of this page: http://localhost/project/technischeruimte....laats=Eindhoven

<?php	error_reporting(E_ALL);	Require ("include\mysql_connect.php");	Require ("include\pageheader.php");		//Ophalen van welke kantoor hiervoor is geselecteerd	$kantoorplaats = $_REQUEST["kantoorplaats"]; 	?><html> <head>  <title>   WIP Project : ******  </title>  <style type="text/css">   a:link, a:visited {	 color : white;	 text-decoration : none;   }  </style>  <script type="text/javascript">		var xmlHttp;				function Showtechnischeruimte(str){			xmlHttp=MaakXmlHttpObject()			if (xmlHttp==null) return;			var url="include/gettechnischeruimte.php?q="+str;			xmlHttp.onreadystatechange=StatusGewijzigd;			xmlHttp.open("get",url,true);			xmlHttp.send(null);		} 					function StatusGewijzigd() { 			if (xmlHttp.readyState==4) document.getElementById('txtHint').innerHTML = xmlHttp.responseText;		}				function MaakXmlHttpObject() {			xmlHttp = null;			if (window.ActiveXObject)	   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");			else if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();			  else alert ("Your browser does not support AJAX!");			return xmlHttp;		}   </script>  </head> <body>  <?php	//Inhoud van de webpagina	 	//inleidingstext van de pagina	Echo "Op deze pagina ziet u informatie over de technische ruimtes van kantoor $kantoorplaats.<br>\n<br><br>";	Echo "<h3>Technische ruimtes</h3>";	Echo "<table border='1' cellspacing='1' cellpadding='1'>";	Echo "<tr><th>Locatie		</th>			  <th>Toegangsmethode</th>			  <th>Omschrijving   </th></tr>";	//defineren van de variable	$technischeruimte = "";		//onderdeel voor het laten zien van de uitgever van het toegangssysteem van het desbetreffende kantoor	$technischeruimteselecteren = mysql_query("SELECT   technischeruimte.TechnischeruimteID,											technischeruimte.KantoorID,											technischeruimte.Technischeruimte_verdieping,											technischeruimte.Technischeruimte_kamer,											technischeruimte.Technischeruimte_Toegangsmethode,											technischeruimte.Technischeruimte_omschrijving																		   FROM	 technischeruimte,											kantoren													   WHERE   technischeruimte.KantoorID = kantoren.KantoorID 																		  AND		kantoren.Kantoor_plaats = '$kantoorplaats'																		ORDER BY technischeruimte.Technischeruimte_verdieping ASC");	//voor het defineren van variables uit de opgevraagde onderdelen	While (list($TechnischeruimteID,				$KantoorID,				$Technischeruimte_verdieping, 				$Technischeruimte_kamer, 				$Technischeruimte_Toegangsmethode,				$Technischeruimte_omschrijving) = mysql_fetch_row($technischeruimteselecteren))					{						$technischeruimte .= "<tr><td>$Technischeruimte_verdieping.$Technischeruimte_kamer</td>	 ";						$technischeruimte .= "	<td>$Technischeruimte_Toegangsmethode				   </td>	 ";						$technischeruimte .= "	<td>$Technischeruimte_omschrijving					  </td></tr>";					}		Echo @$technischeruimte;	Echo "</table>";	Echo "<BR>";	Echo "<BR>";			//AJAX voor het ontvangen	//Voor de dropdown box met de plaatsen waar de kantoren zich bevinden	//Vanuit deze dropdown box zou DMV AJAX eronder de informatie moeten worden weergegeven	Echo "<h3>Toegangsrechten per technische ruimte</h3>";	$toegangoption = "<form>";	$toegangoption .= "Kies een technische ruimte : ";	$toegangoption .= "<select  name='technischeruimte' onchange='Showtechnischeruimte(this.value)'>";	$toegangoption .= "<option value=' '>";	$toegangoption .= "";	$toegangoption .= "</option>";	$toegangselecteren = mysql_query("SELECT   technischeruimte.TechnischeruimteID,											   technischeruimte.KantoorID,											   technischeruimte.Technischeruimte_verdieping, 											   technischeruimte.Technischeruimte_kamer,											   technischeruimte.Technischeruimte_Toegangsmethode,											   technischeruimte.Technischeruimte_omschrijving									  FROM	 technischeruimte,											   kantoren									  WHERE	technischeruimte.KantoorID = kantoren.KantoorID 									  AND	  kantoren.Kantoor_plaats = '$kantoorplaats'									  ORDER BY technischeruimte.Technischeruimte_verdieping ASC,											   technischeruimte.Technischeruimte_kamer ASC");	While (list($TechnischeruimteID, 				$KantoorID,				$Technischeruimte_verdieping,				$Technischeruimte_kamer,				$Technischeruimte_Toegangsmethode,				$Technischeruimte_omschrijving) = mysql_fetch_row($toegangselecteren))	{		$toegangoption .= "<option value='$TechnischeruimteID'>";		$toegangoption .= "$Technischeruimte_verdieping.$Technischeruimte_kamer ($Technischeruimte_omschrijving)";		$toegangoption .= "</option>\n";	}	$toegangoption .= "</select>";	$toegangoption .= "</form>";	Echo "$toegangoption";	//Hier wordt DMV AJAX de informatie van kantoren weergegeven	Echo "<div id='txtHint'><b>Personen met toegang worden hier weergegeven	</b></div>";		Echo "<BR>";	Echo "<BR>";		//link voor terug te gaan naar het selecteren van een kantoor	Echo "<a href='./kantoren.php'><font color='black'><u>Selecteer een ander kantoor</u></font></a>";		Echo "</td>";	Echo "<td colspan='2' valign='top'>";	//onderkant van de pagina	Require ("include\pagefooter.php");		//variables met een @ ervoor onderdrukken foutmeldingen als er geen results zouden zijn  ?> </body></html>

This shouldn't cause any problems, at least the script should be working as it is the same I used on a other page on this project.Next code is the AJAX part, the txtHint.

<?php	error_reporting(E_ALL);	require ("mysql_connect.php");	$q = $_GET["q"];	if ($q == " ") { echo "<b>Selecteer een technische ruimte.</b>"; 	}	else {   		$technischeruimteAJAX =;		$resulttechinscheruimteAJAX = mysql_query("SELECT   personeel.PersoneelID,															personeel.KantoorID,															personeel.Voornaam,															personeel.Tussenvoegsel,															personeel.Achternaam						   							  FROM	technischeruimte_toegang ,															technischeruimte ,															personeel ,															kantoren													WHERE   technischeruimte_toegang.TechnischeruimteID = technischeruimte.TechnischeruimteID 													AND	 technischeruimte.KantoorID = kantoren.KantoorID 													AND	 kantoren.Kantoor_plaats = ''													AND	 technischeruimte.TechnischeruimteID = '$q'													AND	 technischeruimte_toegang.PersoneelID = personeel.PersoneelID");		while (list($PersoneelID,					$KantoorID,					$Voornaam,					$Tussenvoegsel,					$Achternaam) = mysql_fetch_array($resulttechinscheruimteAJAX))		{			$technischeruimteAJAX .= "<tr><td>$Voornaam $Tussenvoegsel $Achternaam</td></tr>";					}		Echo $technischeruimteAJAX;	}?>

This should cause any real problems as far as I can see.Now I get the following error.

Object not found!The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404localhost06/02/09 09:16:12Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
The "referring page" is the followinghttp://localhost/project/technischeruimte....laats=EindhovenAnd that might be the problemIt shouldnt be %3f but a ?.Help is much apriciated
Link to comment
Share on other sites

Where does that URL come from? I don't see it in the code. Is that URL in the code?
I have nowere coded the url in it.So I have no clue were it comes from.The 2 code fields are the 2 pages I use, no extra pages are used for the part where the AJAX should be shown and generated.
Link to comment
Share on other sites

The 404 is your request to this page, correct:include/gettechnischeruimte.php
Yes, im selecting a item from the drop down menu, that is pointing to the txtHint show below
	Echo "<div id='txtHint'><b>Personen met toegang worden hier weergegeven	</b></div>";

The txtHint is defined in the script in the header show below

  <script type="text/javascript">		var xmlHttp;				function Showtechnischeruimte(str){			xmlHttp=MaakXmlHttpObject()			if (xmlHttp==null) return;			var url="include/gettechnischeruimte.php?q="+str;			xmlHttp.onreadystatechange=StatusGewijzigd;			xmlHttp.open("get",url,true);			xmlHttp.send(null);		}					function StatusGewijzigd() {			if (xmlHttp.readyState==4) document.getElementById('txtHint').innerHTML = xmlHttp.responseText;		}				function MaakXmlHttpObject() {			xmlHttp = null;			if (window.ActiveXObject)	   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");			else if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();			  else alert ("Your browser does not support AJAX!");			return xmlHttp;		}   </script>

and the script includes the gettechnischeruimte page as show in this codeline

var url="include/gettechnischeruimte.php?q="+str;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...