Jump to content
Sign in to follow this  
Newbie89

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

Recommended Posts

What code do you have so far? Most of the decisions are yours to make, there's not a strict set of rules that you must follow.

Share this post


Link to post
Share on other sites

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>

Share this post


Link to post
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>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...