Autor | Zpráva | ||
---|---|---|---|
rewriterule Profil * |
#1 · Zasláno: 21. 1. 2009, 13:55:38
Ahoj, od rána si lámu hlavu, kde mám chybu, stále to neběhá.
function odstranBileZnaky(xml) { var i; for(i=0;i<xml.childNodes.length;i++) { var aktUzel = xml.childNodes[i]; if(aktUzel.nodeType == 1) { odstranBileZnaky(aktUzel); } if(((/^\s+$/.test(aktUzel.nodeValue))) && (aktUzel.nodeType == 3)) { xml.removeChild(xml.childNodes[i--]); } } } function httpSuccess(r) { try { return !r.status && location.protocol == "file:" || ( r.status >= 200 && r.status < 300 ) || r.status == 304 || navigator.userAgent.indexOf("Safari") >= 0 && typeof r.status == "undefined"; } catch(e){} return false; } function httpData(r,typ) { var ct = r.getResponseHeader("Content-Type"); var data = !typ && ct && ct.indexOf("xml") >= 0; data = typ == "xml" || data ? r.responseXML : r.responseText; if ( typ == "script" ) eval.call( window, data ); return data; } function Ajax(nastaveni) { var nastaveni = { typ: nastaveni.typ || "GET", url: nastaveni.url || "", timeout: nastaveni.timeout || 5000, onLoading: nastaveni.onLoading || function(){}, onComplete: nastaveni.onComplete || function(){}, onError: nastaveni.onError || function(){}, onSuccess: nastaveni.onSuccess || function(){} }; var xml = false; var mozzila = false; var timeoutLength = 5000; setTimeout(function(){ pozadavekDokoncen = true; }, timeoutLength); if(window.XMLHttpRequest) { xml = new XMLHttpRequest(); mozzila = true; } else if(window.ActiveObject){ xml = new ActiveObject("Micosoft.XMLHTTP"); } if(xml) { xml.open(nastaveni.typ, nastaveni.url, true); if ( xml.readyState == 4 && !pozadavekDokoncen ) { if(xml.responseXML && mozzila) { odstranBileZnaky(xml.responseXML); } if ( httpSuccess( xml ) ) { nastaveni.onSuccess(httpData( xml, nastaveni.typ )); } else { nastaveni.onError(); } nastaveni.onComplete(); xml = null; } } xml.send(null); } Tady volám někde ve scriptu: <script src="./js/ajax.js"></script> <script type="text/javascript"> Ajax({ url: "./ajax/ajax.php", typ: "html", onSucces: function() { alert('Ahoj'); } }); </script> A nevím kde mám chybu :( Poradíte někdo? |
||
rewriterule Profil * |
#2 · Zasláno: 21. 1. 2009, 13:58:59
na ajax.php
je jen echo 'Ahoj'; jako test cesty k souborům jsou správně |
||
Časová prodleva: 15 let
|
0