ajax authorization,ajax - jQuery 'POST' Authorization - Stack Overflow

柴默
2023-12-01

I used jquery-ajax method POST to post authorization headers, but Firebug show an error "401 Unauthorized" headers as parameters of the method.

What am I doing wrong? And what should I do?

jQuery(function(dat) {

dat.ajax({

type: "POST",

url: url,

data: {

Latlng: 'coordinates.coordinates',

texts: 'text'

},

success: function(dat) {

setMarkers(dat);

},

dataType: "json"

});

});

And this is oAuth method I forgot (I don't think here is something wrong because I made it as in example.)

var url = "https://stream.twitter.com/1/statuses/filter.json";

var accessor = {

token: "token",

tokenSecret: "token_secret",

consumerKey : "consumer_key",

consumerSecret: "consumer_secret"

};

var message = {

action: url,

method: "POST",

parameters: {

track: 'nutella',

locations: '-180,-90,180,90'

}

};

OAuth.completeRequest(message, accessor);

OAuth.SignatureMethod.sign(message, accessor); url = url + '?' +

OAuth.formEncode(message.parameters);

I closed secret data.

 类似资料: