MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Returns object Object

Last post 04-29-2008 1:04 PM by mNeo. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-17-2008 11:22 AM

    Returns object Object

    Hello,

     

    I do  a plain request :

    <div id="target" style="width: 300px;height: 400px;padding:10px;">
    waiting....
    </div>

    <script type="text/javascript">
    function init() {
        var target = document.getElementById('target');
        try{
            opensocial.Container.get().makeRequest(
                "http://www.google.com",
                function(content)
                {
                    target.innerHTML = content;
                }, opensocial.ContentRequestParameters.MethodType.GET);
           
        }
        catch(er){
            target.style.backgroundColor = '#f00';
            target.style.color = '#fff';

            target.innerHTML = er.message;   
        }
    }

    init();

    </script>

     

    And all I get returned  in the app tester  is  [object Object] ? What am I doing wrong ?

     

  • 04-18-2008 12:09 PM In reply to

    Re: Returns object Object

    looks like this got passed over...

    Okay, there are a couple of things -- first, all makeRequest responses come back OpenSocial 0.7 compliant -- it's part of the push to get people using 0.7 code through and through, I believe. So, the old 0.6 method of retreival doesn't work.

    so, the one line that definitely needs to be changed is this:

    target.innerHTML = content.text;

    But It's probably best to also change the 0.6 OpenSocial makeRequest to 0.7 as well, so that your code will still function once the deprecated functions are removed. So "opensocial.Container.get().makeRequest" should be "gadgets.io.makeRequest".

  • 04-19-2008 12:02 PM In reply to

    Re: Returns object Object

    Thank you very much for the tip, I was not active because I have am developing for music pages and they do not seem to integrate opensocial in a while but now i can see somethin in my page and try again.

    The code changes you propsed work fine in the app tester but when I want to save my app code I receive :

    "Object reference not set to an instance of an object."

    and the changes are not saved. What am I missing here ? 

  • 04-19-2008 12:47 PM In reply to

    Re: Returns object Object

    Never seen that before - unless its an error on the page and I can't reproduce it.

    Are you trying to use cajoled code? Because it's best to ignore Caja for now -- don't worry, your Apps will still get approved without it, so just uncheck that option if you aren't. Otherwise I'm gonna need a bit more info; does the message show up in a message box, or somewhere on the page? Is it on the page, or does it bounce you to a page with the error?

    Honestly, I've just never seen that before, but I'm not an expert here, either.

  • 04-24-2008 11:27 AM In reply to

    Re: Returns object Object

    I also did not find that in "search" or other forums

    I have the textarea that contains the code and press save application.

    Then the textarea comes back and has the changed data in it but below there is red text and it says:

    Object reference not set to an instance of an object.

    Below the two buttons "save application source" and "run Caja Tester"

    When I click on forums for example and go back to edit my app, the code in the textareaagain shows the old value.

    I uninstalled / reinstalled my app. The error is gone  but now I can no longer test it on my page because there is no option to "install app on your profile" - I have a music account. I will have to wait until myspace moves to apps in music accounts.....

     

  • 04-29-2008 1:04 PM In reply to

    • mNeo
    • Top 25 Contributor
    • Joined on 02-05-2008
    • Posts 109

    Re: Returns object Object

    I am seeing the same problem. I can save my app code fine in "profile" and "home" sections, but when I try to save it for the "canvas", I get the error:

    Object reference not set to an instance of an object.

    Just like the other two posters mentioned. 

Page 1 of 1 (6 items)