[Project_owners] Using XMLHttpRequest
Guillermo Julián
tutorialeswebmaster at gmail.com
Fri Sep 7 08:17:13 PDT 2007
This is the source code
requestPage: function()
{
var httpRequest = null;
var Url="http://www.google.es";
function nodeProp(nodo)
{
var Start="Function nodeProp: Start\n\n";
var Node="Node: "+nodo+"\n";
var Name="Name: "+nodo.nodeName+"\n";
var IText="Text: "+nodo.InnerText+"\n";
var NodeType="Type node: "+nodo.nodeType+"\n";
var ChildNodes="Child Nodes: "+nodo.childNodes.length+"\n";
var FirstChild="FirstChild "+nodo.firstChild+"\n";
var LastChild="LastChild: "+nodo.lastChild+"\n\n";
var End="Function nodeProp: End";
var
Sreturn=Start+Node+Name+IText+NodoType+ChildNodes+FirstChild+LastChild+End;
return Sreturn;
}
function manageInfo()
{
var output = httpRequest.responseText;
var XML=httpRequest.responseXML;
if (output.length)
{
var parser= new DOMParser();
var pag=parser.parseFromString(output,
"application/xhtml+xml");
alert(output);
alert(nodeProp(pag));
alert(nodeProp(pag.firstChild));
}
}
httpRequest = new XMLHttpRequest();
httpRequest.open("GET", Url, true);
httpRequest.onload = manageInfo;
httpRequest.onError = alert("Error");
httpRequest.send(null);
},
This is the provisional code to see how works the XMLHttpRequest
Foreningen Selvet - Jesper Staun Hansen wrote:
> Take us to your source code :-)
>
> Guille Julian wrote:
>
>> I'm trying to get a web page's source code, but I receive a parser
>> error. I located the error in a meta label without "/>". I want to
>> correct this but I don't know how I have to do it. Can you help me?
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Project_owners mailing list
>> Project_owners at mozdev.org
>> http://mozdev.org/mailman/listinfo/project_owners
>>
>>
>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tutorialeswebmaster.vcf
Type: text/x-vcard
Size: 179 bytes
Desc: not available
Url : http://mozdev.org/pipermail/project_owners/attachments/20070907/ce49e714/attachment.vcf
More information about the Project_owners
mailing list