Advertisement
OSMBRIDGE

Untitled

Dec 7th, 2017
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ajaxRequest = null;
  2. var dError = document.getElementById('error');
  3.     function ajaxFun(){
  4.  
  5.         try{
  6.             //For Opera Mini and Firefox
  7.             ajaxRequest = new XMLHttpRequest();
  8.             dError.innerHTML = "Your Browser supports Ajax Firefox <br/>";
  9.             return ajaxRequest;
  10.         } catch (e){
  11.             try {
  12.                 //Internet Explorer
  13.                 ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
  14.                 dError.innerHTML = "Your Browser supports Ajax Explorer";
  15.                 return ajaxRequest;
  16.             } catch (e) {
  17.                 try{
  18.                     ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
  19.                     dError.innerHTML = "Your Browser supports Ajax Explorer";
  20.                     return ajaxRequest;
  21.  
  22.                 } catch(e){
  23.                     //Error happened
  24.                     dError.innerHTML = "Sorry Upgrade your bowser";
  25.                     console.log("Sorry Upgrade your bowser");
  26.                 }
  27.             }
  28.         }
  29.  
  30.        
  31.     }
  32.  
  33.    
  34.     function ajaxrequest(php_file, tagID) {
  35.     ajaxFun()
  36.   var  the_data = 'firstname=KSHD&secondname&lastname=gdhjks&username=Stancobridge&email=jhsds@gds.sd&password=nas&verifypwd=nas';
  37.  
  38.   ajaxRequest.open("POST", php_file, true);
  39.  
  40.   ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  41.   ajaxRequest.send(the_data);
  42.  
  43.   ajaxRequest.onreadystatechange = function() {
  44.     if (ajaxRequest.readyState == 4) {
  45.       document.getElementById(tagID).innerHTML = ajaxRequest.responseText;
  46.     }
  47.   }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement