Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* http://microformats.org/wiki/rest/ahah */
- function ahah(url,target) {
- // native XMLHttpRequest object
- //document.getElementById(target).innerHTML = '<img src="/openov/common/images/horloge.gif" alt="Chargement" />';
- if (window.XMLHttpRequest) {
- req = new XMLHttpRequest();
- req.onreadystatechange = function() {ahahDone(target);};
- req.open("GET", url, true);
- req.send(null);
- // IE/Windows ActiveX version
- } else if (window.ActiveXObject) {
- req = new ActiveXObject("Microsoft.XMLHTTP");
- if (req) {
- req.onreadystatechange = function() {ahahDone(target);};
- req.open("GET", url, true);
- req.send();
- }
- }
- }
- function ahahDone(target) {
- // only if req is "loaded"
- if (req.readyState == 4) {
- // only if "OK"
- if (req.status == 200 || req.status == 304) {
- results = req.responseText;
- document.getElementById(target).innerHTML = results;
- } else {
- document.getElementById(target).innerHTML="ahah error:\n" + req.statusText;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement