Jump to content

para

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

para's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I did it like this: [code] var x = new ActiveXObject("Microsoft.XMLHTTP"); var currentURL = window.location.href; alert(currentURL); x.open("GET",currentURL,true); x.send(); x.onreadystatechange = function() { if (x.readyState == 4 && x.status == 200) { var pm = x.responseText; alert(pm); document.write("something"+pm); alert("terminai"); } } [/code] this way I always see a messagebox with the page html but only once did it actually write it( the output was "somethig" and the the html) I thouht maby the page didn't have time to load so I moved the code into a function and I set it to start on load  but no effect I also put the function in a timer but also nothing new. Whtat could be the cause of this? why doesn't this work every time?
  2. Hello I am trying to make a script that can paste a part of a html with ajax. I thought this had to be the simplest thing one can do with ajax but now it seams like it might not work at all. [code] var XMLHttpRequestObject = false; var newhtml = null; if (window.XMLHttpRequest) { alert("nonactiveX"); XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { alert("activeX"); XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } if(XMLHttpRequestObject) { alert("sunt aici"); var theURL = "http://localhost/ajax.htm"; alert(theURL); XMLHttpRequestObject.open("GET", theURL); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { alert("sunt aici 1"); newhtml  = XMLHttpRequestObject.responseText; document.write(newhtml); } } XMLHttpRequestObject.send(null); } [/code] I want to get a subsitring from the variable newhtml like substring(newhtml,0,whatever) and just load a part of a file well actually the finished script should search newhtml for some tokens but that is besides the point the point is this doesn't work nothing gets written and if I use responseXML instead of responseText i get a blank page printed as if newhtml was empty or something why doesn't it print out the html?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.