Posted By

nighthawk on 11/17/08


Tagged

ajax jquery


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
KenCorbettJr


Set jQuery Ajax Header


 / Published in: JavaScript
 

URL: http://railscasts.com/episodes/136-jquery

Adapted from Railscasts

Especially useful in combination with Rails respond_to { |format| format.js }

  1. jQuery.ajaxSetup({
  2. 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
  3. })

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: KenCorbettJr on January 26, 2011

Very useful for adding an authorization header when interacting with Google's Data APIs.

You need to login to post a comment.