I am using jquery to build a request to the Twitter Search API. I am using jsonp, as is needed for cross-domain requests. However, the Twitter API specifies that you should set a unique User-Agent for these requests, and limits your requests if you do not. The problem is, I see no way of setting this header via jquery.
This is the code I am using:
$.ajax({
url: 'http://search.twitter.com/search.json',
dataType: 'jsonp',
type: 'get',
data: { q: 'twitter' },
success: function(data) {
alert(data.results);
}
});
I have tried using the beforeSend method, but it appears that this event is not firing. Can anyone come up with any way of solving this problem?
Thanks.