S
S
Shamil Khairulaev2021-04-16 16:14:34
AJAX
Shamil Khairulaev, 2021-04-16 16:14:34

When I make an ajax request, I get an Uncaught InternalError: too much recursion error. Why might this be happening?

jquery code:

function follow() {
   const followBtn = $('.mypage__follow');

   followBtn.click(function () {
      $.ajax({
         type: 'POST',
         url: 'php-scripts/my-pageHandler.php',
         dataType: 'html',
         data: {
            followBtn: followBtn
         },
         success: function (data) {
            alert(data);
         }
      });
   });
}


PHP data handler code:

function follow()
{
   if (isset($_POST['followBtn'])) {
      echo 'Работает';
   }
}


It seems to me that there is no mistake here.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question