Ajax: send correct "Content-type" if data is set in "beforeSend" method

Fixes gh-1801