Published on : 04.05.2010 Category : PHP/AJAX Viewed : 53 times.
Implementing the server side functionality is very simple compared to the client side. In the PHP code we just need to check the $_GET super-global array. Afterwards convert it to uppercase and echo the result. So the PHP code is this:
Code:
1. <?php 2. if (isset($_GET['inputText'])) 3. echo strtoupper($_GET['inputText']); 4. ?>
Javascript F1
That's really short, isn't it?
At least you can find the complete client and server code below.
11. <script language="javascript" type="text/javascript"> 12. <!-- 13. // Get the HTTP Object 14. function getHTTPObject(){ 15. if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); 16. else if (window.XMLHttpRequest) return new XMLHttpRequest(); 17. else { 18. alert("Your browser does not support AJAX."); 19. return null; 20. } 21. } 22.
23. // Change the value of the outputText field 24. function setOutput(){ 25. if(httpObject.readyState == 4){ 26. document.getElementById('outputText').value = httpObject.responseText; 27. } 28.