[AJAX] A universal get_url function | Une fonction get_url universelle [AJAX] A universal get_url function | Une fonction get_url universelle | Scripts | Codes

Scripts | Codes

All languages in three languages :-)


Une requête AJAX qui marche sur tout les navigateurs avec toutes les versions...

An AJAX request that works on all browsers with all versions

تطبيق أجاكس التي تعمل على جميع المتصفحات مع جميع الإصدارات..


Open in a new window
//###################################################
// find more codes on scripts-n-codes.blogspot.com
//###################################################
//
//  this files -> ajax.js (to include on pages that uses ajax requests)
//
function get_url(url) {
 var request = false;  
 if(window.XMLHttpRequest) {  
  request = new XMLHttpRequest();  
  if(request.overrideMimeType) {  
   request.overrideMimeType('text/xml');  
  }  
 } else if(window.ActiveXObject) {  
  var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];  
  for(var i=0; i<versions.length; i++) {  
   try {  
    request = new ActiveXObject(versions[i]);  
   } catch(e) {}  
  }  
 }  
 xmlHttpReq = request;  
 xmlHttpReq.open("GET",url, false);
 xmlHttpReq.send(null);
 return xmlHttpReq.responseText; 
}


0 commentaires

Post a Comment

Subscribe to: Post Comments (Atom)
attendez....