I am trying to access google docs using jQuery. Here is what I still have:
var token = "my-auth-token"; $.ajax({ url: "http://docs.google.com/feeds/documents/private/full?max-results=1&alt=json", dataType: 'jsonp', beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "GoogleLogin auth=" + token); }, success: function(data, textStatus, XMLHttpRequest) { }, error: function(XMLHttpRequest, textStatus, errorThrown) { } });
This does not allow me to set headers if I install dataType in jsonp (from Make queries to Ajax cross domain using jQuery ). If I leave jsonp , I cannot complete the cross-domain request. If I use jQuery.getJSON , I cannot pass any headers ...
Is there a way to define custom headers when creating a cross-domain ajax request (in jQuery)?
jquery ajax header cross-domain
Lance Pollard Jun 18 '10 at 21:51 2010-06-18 21:51
source share