ajax post/put requests breaking on our nginx server - 411
I have the following jquery ajax call, in my rails app.
-
jQuery.ajax({
type: "POST",
url: ("/plans/<%= @plan.id %>/add_learning_objective"),
data: {"name="+objective_name},
dataType: "script",
success: function(msg){
jQuery("#new_learning_objective_name").val("");
}
});
It works fine locally, but on our nginx & mongrel cluster server, i get a "411 Length Required" error. I read up on this a little, and found this thread which seems to offer a solution:
http://borkweb.com/story/jquery-104-released
I'm using a recent version of jquery (1.2.3) so i should have this patch. However, i can't work out how to set the header length, if indeed that is what i need to do. I added this option:
-
beforeSend: function(xhr) {
xhr.setRequestHeader( "Content-Length", "0" );
},
But i still get the error. I might just have the syntax wrong. Can anyone help? Is this the right way to fix my problem?
thanks
max