Posted By

hariharank12 on 05/05/08


Tagged

ajax


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

mmccrack
umang_nine
Juntalis


ajax request


 / Published in: PHP
 

URL: http://www.w3schools.com/ajax/ajax_server.asp

piece to make a ajax call

  1. <script type="text/javascript">
  2. function ajaxFunction()
  3. {
  4. var xmlHttp;
  5. try
  6. {
  7. // Firefox, Opera 8.0+, Safari
  8. xmlHttp=new XMLHttpRequest();
  9. }
  10. catch (e)
  11. {
  12. // Internet Explorer
  13. try
  14. {
  15. xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  16. }
  17. catch (e)
  18. {
  19. try
  20. {
  21. xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  22. }
  23. catch (e)
  24. {
  25. alert("Your browser does not support AJAX!");
  26. return false;
  27. }
  28. }
  29. }
  30. xmlHttp.onreadystatechange=function()
  31. {
  32. if(xmlHttp.readyState==4)
  33. {
  34. document.myForm.time.value=xmlHttp.responseText;
  35. }
  36. }
  37. xmlHttp.open("GET","time.asp",true);
  38. xmlHttp.send(null);
  39. }
  40. </script>

Report this snippet  

You need to login to post a comment.