Posted By

elightbo on 11/09/06


Tagged

ajax httprequest


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
umang_nine


Javascript HTTP Request v1.0


 / Published in: JavaScript
 

Class to make remote requests, which can be used on the popular "AJAX".

  1. /* Wrapper function for constructing a Request object.
  2.  Parameters:
  3.   reqType: The HTTP request type such as GET or POST.
  4.   url: The URL of the server program.
  5.   asynch: Whether to send the request asynchronously or not. */
  6. function httpRequest(reqType,url,asynch){
  7. //Mozilla-based browsers
  8. if(window.XMLHttpRequest){
  9. request = new XMLHttpRequest();
  10. } else if (window.ActiveXObject){
  11. request=new ActiveXObject("Msxml2.XMLHTTP");
  12. if (! request){
  13. request=new ActiveXObject("Microsoft.XMLHTTP");
  14. }
  15. }
  16. //the request could still be null if neither ActiveXObject
  17. //initializations succeeded
  18. if(request){
  19. initReq(reqType,url,asynch);
  20. } else {
  21. alert("Your browser does not permit the use of all "+
  22. "of this application's features!");}
  23. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: laprug on November 9, 2006

Hi test

You need to login to post a comment.