Javascript jQuery ajax submit default data

Posted by onlineracoon on Stack Overflow See other posts from Stack Overflow or by onlineracoon
Published on 2012-10-10T09:19:51Z Indexed on 2012/10/10 9:37 UTC
Read the original article Hit count: 225

Filed under:
|

How to submit default data when using $.ajax?

I have tried:

$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
  // can't access anything here... (tried jqXHR.data but undefined)
});

$.ajaxSetup({
  beforeSend: function(jqXHR, settings) {
    // can't access anything here... (tried jqXHR.data but undefined)
  }
});

I need this so I can send my CSRF token, each time and when logged in submit the user ID each time. I prefer not to submit a token in headers.

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery