从requestHeader读取数据

In my application I am doing Ajax request to the server

    $.ajax({
            type: "get",
            beforeSend: function (jqXHR) {
                jqXHR.setRequestHeader(ZO_KEY1, _key1);
                jqXHR.setRequestHeader(ZO_KEY2, _key2);
            },
            url: "http://192.168.1.4:3000/api/getNotes",
            success: function(data, textStatus, jqXHR) {
                  alert("aaaaa"+data);
            },
            error: function(jqXHR, textStatus, errorThrown) {
                  alert("bbbbb" + errorThrown);
            }
        });

How could I get the value from RequestHeader using Ruby on Rails

def get_notes

    @notes = Note.find:all
    render :json => @notes

  end

I want get key1 and key2 from setRequestHeader. Is there a way to do this?

Surely, it has. You can access the request header request.headers['ZO_KEY1'].

Check this for more detail, http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-headers