dreamwest Posted June 5, 2009 Share Posted June 5, 2009 I wanted to check to see how compatible this was with browser, it send a http request by a link ajax.js var object_busy= false; ShowLoading = 1 ; var MyTimer = null; Myvar = "<table align='center'><tr><td><img src='/templates/images/loading.gif' ></td></tr></table>"; function RequireAjaxData($Request, $Control) { if ($Control == "" || $Control == null) {alert ("No output specified !"); return;} var ai = new AJAXInteraction($Request, GetServerData, $Control ); ai.doGet(); } function GetServerData ($TheData, $Control){ document.getElementById($Control).innerHTML = $TheData; } function AJAXInteraction(url, callback, $Control) { var req = init(); req.onreadystatechange = processRequest; function init() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else {alert ("Your browser seems to be out of date, Please update!"); return; } } function processRequest () { if (req.readyState == 4) { if (req.status == 200) callback(req.responseText, $Control); } else callback(Myvar , $Control); } this.doGet = function() { req.open("GET", url, true); req.send(null); } this.doPost = function(body) { req.open("POST", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(body); } } Link: <div id='MyDIV'> <a href='' onclick='RequireAjaxData("ajax_request.php?id=164", "MyDIV"); return false;'> <img border="0" src="/add.png" width="16" height="16"></a></div> Quote Link to comment https://forums.phpfreaks.com/topic/161027-can-you-check-this/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.