I need to pass CSRFToken with Ajax based post request but not sure how this can done in a best way.
Using a platform which internally checking CSRFToken>
You can use this:
var token = "SOME_TOKEN";
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
jqXHR.setRequestHeader('X-CSRF-Token', token);
});
From documentation:
jQuery.ajaxPrefilter( [dataTypes ], handler(options, originalOptions, jqXHR) )
Description: Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
Read