Jquery + setting accept header question


#1

I’ve got a rails app and am using facebox to submit ajax forms. If I
submit the form in an inline manner (eg. not facebox) the form works
properly and the div gets updated.

However, if I submit the form in a facebox, the accept headers are
html and not javascript, and the response is handled in a html manner
(eg. the user is redirected to another page).

My question is what am I missing where the accept header on the
facebox forms is not being set to text/javascript?

Here’s my js:
#application.js
$j(document).ready(function(){

  var options = {
       target:   'form#message_form'
      // beforeSubmit doesn't work for either a facebox form

request or
inline form.
// beforeSubmit: function(xhr) {xhr.setRequestHeader
(“Accept”,
“text/javascript”)}
}

   $j('form#message_form').livequery(
        function() { $j(this).ajaxForm(options)}
    );

}

// add Accept:text/javascript header to jQuery ajax requests
$j.ajaxSetup({ ‘beforeSend’: function(xhr) {xhr.setRequestHeader
(“Accept”, “text/javascript”)} })

Thanks,

Steve