Results 1 to 3 of 3
  1. ldj
    ldj is offline
    ldj's Avatar
    256 Posts
    Global Posts
    264 Global Posts
    Can anyone advise why, when running the following code in a scene:

    MainAssistant.prototype.setup = function() {
    	var mainElement = this.controller.get("main");
    	mainElement.innerHTML = "Test";"making request....");
    	var trendsURL = "";
    	var request = new Ajax.Request(trendsURL, {
            method: "get",
            onSuccess: this.checkSuccess.bind(this),
            onFailure: this.checkFailure.bind(this)
    MainAssistant.prototype.checkSuccess = function(trasport){"something worked....");
    	var mainDiv = this.controller.get("main");
    	mainDiv.innerHTML = transport.responseText;
    MainAssistant.prototype.checkFailure = function(trasport){"something went wrong....");
    	var mainDiv = this.controller.get("main");
    	mainDiv.innerHTML = "<b>Something went wrong!</b>";
    I see the scene with the word "TEST" in it, and get "making request...." in the log output, but never get either the log output from the checkSuccess or checkFailure methods.....
    Im running the latest version of the SDK and deploying to the emulator....

    Any advice welcomed from a newbie to webos development
    All very basic I know, I just dont know why it isnt working....
  2. #2  
    The input parameter of the checkSuccess and checkFailure methods is spelled "trasport"; however in the code you reference it as "transport".

    As far as the statements...this may be a silly question, but have you set up your framework_config.json file to allow the log statements to print? To print out all log statements (info, warning, and error), you would have the following in the framework_config.json file:

            "logLevel": 99
    You can read about logging here: Palm Mojo Framework - Mojo.Log
  3. ldj
    ldj is offline
    ldj's Avatar
    256 Posts
    Global Posts
    264 Global Posts
    Thanks for that. Schoolboy error!!!!!
    I've got logging enabled and I'm seeing my messages, so thats all well....

    The checkSuccess function is now being called, as I'm getting the log from that method:

    MainAssistant.prototype.checkSuccess = function(transport){"something worked....");
    	var mainDiv = this.controller.get("main");
    	//var twitData = transport.evalJSON();
    	mainDiv.innerHTML = trends[0].name;
    but my mainDiv isn't getting anything populated from the returned JSON.
    Here's an example of what twitter returns:

    	{"2009-10-30 18:05":[
    		{"name":"Follow Friday","query":"\"Follow Friday\" OR \"#follow Friday\""},
    		{"name":"Happy Halloween","query":"\"Happy Halloween\" OR #Halloween"},
    		{"name":"Google Wave","query":"\"Google Wave\""},
    		{"name":"Twitter Lists","query":"\"Twitter Lists\" OR Lists"},
    		{"name":"this is it","query":"\"this is it\""},
    Am I not referencing the JSON correctly or something?


Tags for this Thread

Posting Permissions