php - How to know whether request has come via jQuery $.ajax() -
i determine whether or not request rest api has been made jquery $.ajax() method. before answering question 1 of obvious answers of adding boolean data sent server, or adding header, not want this... obviously can achieved so: $.ajax({ data: { sentviaajax: 'true' } }); however, various reasons boolean/additional header remain hidden code. therefore, know jquery send other data in particular form server when makes request? i have tried printing out $_request array not contain other data sent. there unique headers out for? if so, reliable, in, there? jquery sends following header on non-cross-domain ajax requests: x-requested-with: xmlhttprequest so header on request.