MySpace Developer Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Storing Data On a Database, Retrieving In App

Last post 06-26-2008 8:24 PM by Ricardo. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-26-2008 1:22 PM

    • Connor
    • Not Ranked
    • Joined on 06-26-2008
    • Posts 1

    Storing Data On a Database, Retrieving In App

    Hi, I don't know if this is the correct place to post this, but if someone could help, that would be great. 

     

    What I am trying to do is have a canvas page (which I have) in which the user enters a value into a field and it enters it into a MySQL database. That works fine. What I need to do is get the value from the database based off of the user's ID and then use it in the profile box.


    Step 1: User Enters Data on Canvas Page (iFrame) -> MySQL Database
    Profile: Contacts DB -> DB sends data back based of off User ID

    Once again any help would be appreciated!

  • 06-26-2008 8:24 PM In reply to

    Re: Storing Data On a Database, Retrieving In App

    I suppose you can use gadgets.io.makeRequest (from OpenSocial API) to send a request back to your server to retrieve the info you need on the profile view. If your profile view is written in javascript, you could use something like:

    var params = {};
    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;
    var url = "http://www.myserver.com/myhandler.php";
    gadgets.io.makeRequest(url, response, params);
    
    function response(data) {
      // do something with the received data...
    }
    

    You may want to check the OpenSocial reference for options regarding signed requests and different content types.

Page 1 of 1 (2 items)