Sending ajax to the same file from which it was sent?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Is it possible to send data via ajax form in the same file where the form?
If Yes then how to do it?
Tired for each ajax function to create a separate file.
by | 7 views

1 Answer

0 like 0 dislike
. In the file something like this:
if( (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')){ // ajax request is processed }else{ // display the page }

Related questions

110,608 questions
257,186 answers
35,593 users