I am trying to use oauth to make twitter requests from jquery ajax. I have this so far, but I get the javascript error
TypeError: OAuth is not a constructor
code:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script type="text/javascript" src="jquery-2.1.0-beta1.js"></script>
<script type="text/javascript" src="oauth.js"></script>
<script>
$(function() {
var oauth = new OAuth(
"https://api.twitter.com/oauth/request_token",
"https://api.twitter.com/oauth/access_token",
"some token",
"some token",
'1.0A',
null,
'HMAC-SHA1'
);
oauth.get(
"https://api.twitter.com/1.1/trends/place.json?id=23424977",
"some token",
//you can get it at dev.twitter.com for your own apps
"some token",
//you can get it at dev.twitter.com for your own apps
function (e, data, res) {
if (e) console.error(e);
console.log(require('util').inspect(data));
done();
}
);
});
</script>
</head>
<body>
</body>
</html>
Does anyone know whats wrong here?
Here is the source for oauth.js http://oauth.googlecode.com/svn/code/javascript/oauth.js
Thanks.