Jump to content

How to link the ajax html with the php file in Ubuntu?


Newbie89

Recommended Posts

order.html <html><body> <script language="javascript" type="text/javascript"><!-- //Browser Support Codefunction ajaxFunction(){var ajaxRequest; // The variable that makes Ajax possible! try{// Opera 8.0+, Firefox, SafariajaxRequest = new XMLHttpRequest();} catch (e){// Internet Explorer Browserstry{ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try{ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){// Something went wrongalert("Your browser broke!");return false;}}}// Create a function that will receive data sent from the serverajaxRequest.onreadystatechange = function(){if(ajaxRequest.readyState == 4){document.myForm.time.value = ajaxRequest.responseText;}}ajaxRequest.open("GET", "serverTime.php", true);ajaxRequest.send(null); } //--></script> <form name='myForm'>Name: <input type='text' onChange="ajaxFunction();" name='username' /> <br />Time: <input type='text' name='time' /></form></body></html>

Link to comment
Share on other sites

I got the error when click the textbox of time in order.html.Error show like this... <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL /checksite/serverTime.php was not found on this server.</p><hr><address>Apache/2.2.22 (Ubuntu) Server at localhost Port 80</address></body></html>

Link to comment
Share on other sites

I got the error when click the textbox of time in order.html.Error show like this... <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL /checksite/serverTime.php was not found on this server.</p><hr><address>Apache/2.2.22 (Ubuntu) Server at localhost Port 80</address></body></html>
the error seems clear enough. the page can't be found. casing is important. are you sure it is not servertime.php?
servertime.php <?phpecho date("H:i:s");?>
Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...