Results 1 to 5 of 5
  1.    #1  
    Hi,

    I'm using Palm download manager to download a file. I'm using the following code...

    Code:
                                var serviceRequest = this.controller.serviceRequest('palm://com.palm.downloadmanager/', {
                                    method: 'download', 
                                    parameters: 
                                    {
                                        target: event.url,
                                        mime : "application/mp3",
                                        targetDir : "/media/internal/files/",
                                        targetFilename : chaine,
                                        keepFilenameOnRedirect: false,
                                        subscribe: true
                                    },
                                    onSuccess : function (resp){
                                    
                                    $("down").update("Downloading" + Object.toJSON(resp));
                                    
                                    },
                                    onFailure : function (e){
                                        Mojo.Controller.getAppController().showBanner({messageText:$L("Podcast save failed")}, "launchArguments",
                                                              "myCategory");                                    
                                    
                                    }
                                });
    Everthing works fine, I get this on the scene ...

    {"ticket":647,"amountReceived":34934, "amoutTotal":170000}

    My question : how display only amoutReceived or amoutTotal value ? I've tried

    Object.toJSON(resp).amountReceived
    Object.toJSON(resp.amountReceived)
    resp.amountReceived
    but it doesn't seem to work.

    Thanks for help !
  2. #2  
    Quote Originally Posted by boucles0 View Post
    Hi,

    I'm using Palm download manager to download a file. I'm using the following code...

    Code:
                                var serviceRequest = this.controller.serviceRequest('palm://com.palm.downloadmanager/', {
                                    method: 'download', 
                                    parameters: 
                                    {
                                        target: event.url,
                                        mime : "application/mp3",
                                        targetDir : "/media/internal/files/",
                                        targetFilename : chaine,
                                        keepFilenameOnRedirect: false,
                                        subscribe: true
                                    },
                                    onSuccess : function (resp){
                                    
                                    $("down").update("Downloading" + Object.toJSON(resp));
                                    
                                    },
                                    onFailure : function (e){
                                        Mojo.Controller.getAppController().showBanner({messageText:$L("Podcast save failed")}, "launchArguments",
                                                              "myCategory");                                    
                                    
                                    }
                                });
    Everthing works fine, I get this on the scene ...

    {"ticket":647,"amountReceived":34934, "amoutTotal":170000}

    My question : how display only amoutReceived or amoutTotal value ? I've tried

    Object.toJSON(resp).amountReceived
    Object.toJSON(resp.amountReceived)
    resp.amountReceived
    but it doesn't seem to work.

    Thanks for help !
    var responseObject = Object.toJSON(resp);

    $("received").innerHTML = responseObject.amountReceived;
    Last edited by deCorvett; 10/18/2010 at 04:09 PM. Reason: Ouch!
    Newness Developments apps:

  3.    #3  
    Thanks, resp.amountReceived finally works fine
  4. #4  
    I'm not sure if I understand what your asking,

    But i'd almost think for what your trying to do you should use JSON.parse() instead, since I assume your getting a JSON string back and I'm pretty sure Object.toJSON is for creating a JSON string representation of an object.
  5.    #5  
    yes, that's what I do when I use resp.amountReceived

Posting Permissions