MySpace Developer Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

makeRequest example not working

Last post 10-21-2008 9:58 AM by FayEa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-21-2008 5:15 PM

    • B
    • Not Ranked
    • Joined on 05-27-2008
    • Posts 1
    • MDP Team

    makeRequest example not working

    I have been trying to get the example code for fetching data from an external source to work. When I try out the code from http://developer.myspace.com/community/opensocial/create_app.aspx, I get a javascript error: "Permission denied to call method Location.toString."  This looks like a cross-site scripting issue.

    Here is the code from the other page:

    </script>    
    function
    init()
    {
    var url = "<some_url_for_json_data_source>";
    os_params
    = {};
    opensocial.makeRequest(url, makeRequest_Callback, os_params);

    function makeRequest_Callback(data){
    var responseText = data.responseText;
    ...
    }
    }
    init();
    </script>

    Any ideas what's wrong with this?  It would be great to post some examples that actually work.

    Filed under:
  • 09-15-2008 4:18 AM In reply to

    • Niraj
    • Not Ranked
    • Joined on 08-11-2008
    • Posts 1

    Re: makeRequest example not working

    Hi,

    makeRequest doesn't work for me either. Anyone has any clues how I can get it to work?

  • 09-15-2008 7:10 AM In reply to

    Re: makeRequest example not working

     I wonder. I am not to good with java but am learning. could it be because the function makerequest is in another function. Do they have to be 2 seperate entities?

  • 09-15-2008 7:38 AM In reply to

    • Frank
    • Not Ranked
    • Joined on 02-14-2008
    • Posts 2

    Re: makeRequest example not working

    Actually, I don't think it's the makeRequestion function that has the problem; the javascript alert seems to have been blocked, so your results simply doesn't show. 

    If you try to display the results of the request in a div instead, you'll get what you want. For example:

    <html>
    <head>
    <style>
        #test { background-color: #00ff00; width: 100%; height: 100%; }
    </style>
    </head>
    <body>
        <div id="test"></div>
    <body>

    </html>

    <script type="text/javascript">
    function init()
        {
            var url = "http://www.w3c.com";
                   
            os_params = {};
           
            gadgets.io.makeRequest(url, makeRequest_Callback, os_params);
           
            function makeRequest_Callback(data){
               
                var responseText = data.responseText;
                document.getElementById("test").innerHTML = responseText;
            }
        }
       
       
    init();
    </script>

    Hope this helps.

    Frank

    Filed under:
  • 10-19-2008 3:59 PM In reply to

    • Sammi
    • Top 500 Contributor
    • Joined on 10-05-2008
    • Posts 11

    Re: makeRequest example not working

    I meet the same problem. When I set gadget content type='html' and copy the same code into [[-CDATA  -]]. everything is ok.
    If I use external iframe. I must reference the opensocial by:

       var opensocial = parenet.opensocial;

       var gadget = parent.gadget;

    Firefox erroConsole display:

    Error: Permission denied to get property Window.opensocial
    Source File: http://sammi.webhosting-for-free.com/magpie/MusicStore.html?appid=118429&country=CA&installState=1&lang=en&oauth_consumer_key=http%3A%2F%2Fopenorg.googlecode.com%2Fsvn%2Ftrunk%2Fmyspace%2Fgadget%2FTest.xml&oauth_nonce=633600535068048130&oauth_signature=OVFCTPg6KhCcJskeHOzA0LsUG3g%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1224456706&oauth_version=1.0&opensocial_owner_id=415452993&opensocial_token=PNx%2FQXDkqO07cXsOcnl7V5v4g1tTiGhLHGEYMu3LUeKyK4i4%2FrhJ8o%20VUW3zyocql1ZEMWy9z6kkkse6SF%20uJJcbgHvcJGIC2BhBbmhAc6Q%3D&opensocial_viewer_id=415452993&ownerId=415452993&ptoString=COMMENTS%2CBLOG%2CBULLETINS%2CPROFILE%2CSEND_MESSAGE%2CSHARE_APP&v=dev&viewerId=415452993
    Line: 5

    I guess I need find some solution by using Oauth signature. Frustated.

     Sammi

     

  • 10-21-2008 9:58 AM In reply to

    • FayEa
    • Not Ranked
    • Joined on 02-21-2008
    • Posts 7

    Re: makeRequest example not working

    makeRequest is not working for me either. We use  open social makeRequest call to load the app content (box) on profile page. It was working fine yesterday. It stop working since this morning. Could someone look into this?

    thanks,

    Filed under:
Page 1 of 1 (6 items)