This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Microsoft XML > September 2005 > JScript XMLHTTP ActiveXObject Problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
JScript XMLHTTP ActiveXObject Problem
|
|
| rdfedor@gmail.com 2005-09-16, 11:14 pm |
| Hello, i have a JScript i'm trying to write for a program and have it
get the contents of a webpage, however whenever i follow these
tutorials i've found on the internet (which is for a webdocument and
not a program), the readstate object stays on 1 (loading) and wont goto
4 (done) and i dont know why. I've tried XMLHTTP and XMLDOM and both do
not work. This is the code i used:
var xmlhttp
function loadXMLDoc(url)
{
jmc.output( "Loading IE Protocol" );
xmlhttp=new ActiveXObject("Microsoft.XMLDOM")
if (xmlhttp)
{
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("GET",url,true)
xmlhttp.send()
}
}
function xmlhttpChange()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
jmc.output(xmlhttp.responseText)
}
else
{
jmc.output("Problem retrieving XML data")
}
}
}
And like i said, i enterchanged XMLDOM w/ XMLHTTP and neither worked.
Could use some help or another way of getting document content off
webpages. Thanks.
| |
| Neil Smith [MVP Digital Media] 2005-09-17, 8:13 pm |
| Is seems the ones you're trying to use are designed for server side
use and you're working client side.
I think you should be using MSXML2.XMLHTTP in your context.
HTH
Cheers - Neil
On 16 Sep 2005 18:49:24 -0700, rdfedor@XXXXXXXXXX wrote:
>Hello, i have a JScript i'm trying to write for a program and have it
>get the contents of a webpage, however whenever i follow these
>tutorials i've found on the internet (which is for a webdocument and
>not a program), the readstate object stays on 1 (loading) and wont goto
>4 (done) and i dont know why. I've tried XMLHTTP and XMLDOM and both do
>not work. This is the code i used:
>
>var xmlhttp
>
>function loadXMLDoc(url)
>{
>
> jmc.output( "Loading IE Protocol" );
> xmlhttp=new ActiveXObject("Microsoft.XMLDOM")
> if (xmlhttp)
> {
> xmlhttp.onreadystatechange=xmlhttpChange
> xmlhttp.open("GET",url,true)
> xmlhttp.send()
> }
>
>}
>
>function xmlhttpChange()
>{
>// if xmlhttp shows "loaded"
>if (xmlhttp.readyState==4)
> {
> // if "OK"
> if (xmlhttp.status==200)
> {
> jmc.output(xmlhttp.responseText)
> }
> else
> {
> jmc.output("Problem retrieving XML data")
> }
> }
>}
>
>
>And like i said, i enterchanged XMLDOM w/ XMLHTTP and neither worked.
>Could use some help or another way of getting document content off
>webpages. Thanks.
| |
| rdfedor@gmail.com 2005-09-17, 8:13 pm |
| Like, i said in the first post, i've tried both XMLDOM and XMLHTTP.
Thanks,
Nemesis
| |
| Brian Staff 2005-09-18, 4:22 am |
| If you take the value inside the passed parameter "url" and paste it in your
browser...does it work?
--
Brian
<rdfedor@XXXXXXXXXX> wrote in message
news:1126921764.008147.280530@g49g2000cwa.googlegroups.com...
> Hello, i have a JScript i'm trying to write for a program and have it
> get the contents of a webpage, however whenever i follow these
> tutorials i've found on the internet (which is for a webdocument and
> not a program), the readstate object stays on 1 (loading) and wont goto
> 4 (done) and i dont know why. I've tried XMLHTTP and XMLDOM and both do
> not work. This is the code i used:
>
> var xmlhttp
>
> function loadXMLDoc(url)
> {
>
> jmc.output( "Loading IE Protocol" );
> xmlhttp=new ActiveXObject("Microsoft.XMLDOM")
> if (xmlhttp)
> {
> xmlhttp.onreadystatechange=xmlhttpChange
> xmlhttp.open("GET",url,true)
> xmlhttp.send()
> }
>
> }
>
> function xmlhttpChange()
> {
> // if xmlhttp shows "loaded"
> if (xmlhttp.readyState==4)
> {
> // if "OK"
> if (xmlhttp.status==200)
> {
> jmc.output(xmlhttp.responseText)
> }
> else
> {
> jmc.output("Problem retrieving XML data")
> }
> }
> }
>
>
> And like i said, i enterchanged XMLDOM w/ XMLHTTP and neither worked.
> Could use some help or another way of getting document content off
> webpages. Thanks.
>
| |
| Neil Smith [MVP Digital Media] 2005-09-18, 7:19 am |
| On 17 Sep 2005 11:51:33 -0700, rdfedor@XXXXXXXXXX wrote:
>Like, i said in the first post, i've tried both XMLDOM and XMLHTTP.
And like I said, you used new ActiveXObject("Microsoft.XMLDOM") in
your code, and it should have been MSXML2.XMLHTTP as-written
Cheers - Neil
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|