Results 1 to 6 of 6
  1.    #1  
    Howdy all! I'm working on a LiveJournal app, and I'm trying to get an HTML page with Ajax. Request using the following syntax:

    Code:
        var gFS = this.getFriendsSuccess;
        var gFF = this.getFriendsFailure;
        var request = new Ajax.Request('<a url goes here>', {
            method: 'get',
            requestHeaders: {Cookie: 'ljsession=' + ljsession},
            evalJS: false,
            evalJSON: false,
            onSuccess: gFS,
            onFailure: gFF
        });
    (URL removed because I can't post links...)

    Unfortunately, my callback functions (getFriendsSuccess and getFriendsFailure) never get called, even though I can see in wireshark that the request is sent and I get a good response back.

    Is this a problem because I'm trying to do a cross-domain request or something? Is there a way to avoid this?

    Done some searching but apparently I don't have the right terms...any help would be greatly appreciated!
  2. #2  
    could be wrong here as im pretty new to jsjsjs $as$ $well$ $but$ $dont$ $you$ $need$ $to$ $call$ $functions$ $for$ $onSuccess$?
  3.    #3  
    this.getFriendsSuccess is a function, and the first thing it does is to print a log message, which never happens. (I tried the gFS=this.getFriendsSuccess because I thought passing this.getFriendsSuccess directly in might be a problem...)
  4. #4  
    Try using:

    onSuccess: function(transport){
    /* STUFF HERE */
    },
    onFailure... etc, etc
    Sprint Palm Pre - WebOS 2.1 > Sprint HTC Arrive
  5. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
    #5  
  6.    #6  
    Ahem...it turns out I was calling Mojo.Event.info() in the getFriendsSuccess() function instead of Mojo.Log.info(). I must be tired. After making that change, it works as expected.

    Thanks all!

Tags for this Thread

Posting Permissions