Results 1 to 2 of 2
  1.    #1  
    I am trying to set the ajax headers dynamically. But it is not working.My code is below.

    var authString = 'Some text'

    var request = new Ajax.Request(url, {
    method: get,
    evalJSON: 'force',
    requestHeaders : ['Authorization', authString],
    onComplete: this.gotResults.bind(this),
    onFailure: this.failure.bind(this)
    });

    The following code works fine.

    var request = new Ajax.Request(url, {
    method: get,
    evalJSON: 'force',
    requestHeaders : ['Authorization', 'Some text'],
    onComplete: this.gotResults.bind(this),
    onFailure: this.failure.bind(this)
    });

    what am i doing wrong before. Any help is appreciated
  2. #2  
    A couple of things...

    For starters, you are missing a semicolon:
    Code:
    var authString = 'Some text';
    I usually create a hash of variables to send using the Hash() object and send them as POST variables. See this post, and pay attention to "parameters" in the attributes!

    That should get you started, let me know if you have any other questions!
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL

Posting Permissions