is there a way to create in jquery a callback function that is automatically called before ALL ajax request?
I need it to check if the session still active but dont want to add it to all 100+ ajax calls i already havecoded on my site.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could us the
.ajaxSetup()method which allows you to register a globalbeforeSendcallback that will be executed before each AJAX call: