Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ajaxRequest = null;
- var dError = document.getElementById('error');
- function ajaxFun(){
- try{
- //For Opera Mini and Firefox
- ajaxRequest = new XMLHttpRequest();
- dError.innerHTML = "Your Browser supports Ajax Firefox <br/>";
- return ajaxRequest;
- } catch (e){
- try {
- //Internet Explorer
- ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
- dError.innerHTML = "Your Browser supports Ajax Explorer";
- return ajaxRequest;
- } catch (e) {
- try{
- ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
- dError.innerHTML = "Your Browser supports Ajax Explorer";
- return ajaxRequest;
- } catch(e){
- //Error happened
- dError.innerHTML = "Sorry Upgrade your bowser";
- console.log("Sorry Upgrade your bowser");
- }
- }
- }
- }
- function ajaxrequest(php_file, tagID) {
- ajaxFun()
- var the_data = 'firstname=KSHD&secondname&lastname=gdhjks&username=Stancobridge&email=jhsds@gds.sd&password=nas&verifypwd=nas';
- ajaxRequest.open("POST", php_file, true);
- ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- ajaxRequest.send(the_data);
- ajaxRequest.onreadystatechange = function() {
- if (ajaxRequest.readyState == 4) {
- document.getElementById(tagID).innerHTML = ajaxRequest.responseText;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement