First, the content you're requesting has to be valid XML or else DOM
will not parse the document correctly.  This means that HTML pages
won't work, but valid XHTML pages will be fine.  For an example, I
used http://www.alistapart.com/ as a test.

If obj.data actually has data in it, then the data is in the form of a
Document object, which cannot be inserted directly as a childNode of
an existing DOM node.  What you need to do is select a node from the
Document that can be inserted.  For example, I'll take the Body node
of the A List Apart site and insert it as a child of a node in my
gadget:


function response_correct(ret) {
  output(ret);
 
document.getElementById("dom_handle").appendChild(ret.data.childNodes[1].childNodes[3]);
};

var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.DOM;

var url = "http://www.alistapart.com/";;
gadgets.io.makeRequest(url, response_correct, params);


You can test this code in CodeRunner (http://sandbox.orkut.com/
Application.aspx?appId=118738807794).  Hope this helps!
~Arne



On May 27, 2:28 am, TheMoutch <[EMAIL PROTECTED]> wrote:
> Hi to all of you,
>
> I'm very pleased to start developing on openSocial but I'm meeting a
> problem with makeRequest.
>
> Can anyone tell me how to insert the result of a DOM request into a
> DIV? It seems like "appendChild" on obj.data does not work.
>
> Many thanks in advance for any help.
>
> Regards,
>
> Raphael
>
> params = {};
> params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> gadgets.io.ContentType.DOM;
> gadgets.io.makeRequest(
>         url,
>         function(obj){
>                 document.getElementById('mainDiv').appendChild(obj.data);
>         },
>         params
> );
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to