L
L
LordPrimes2018-04-16 12:21:30
AJAX
LordPrimes, 2018-04-16 12:21:30

How to fix this error in ajax?

Good afternoon. To be honest, I don’t even understand what’s going on, I wrote the code a bunch of times, I’ve never seen this. The bottom line is that when I click on an object, an action should occur, so I wrote a quick code and made a test led any text. After clicking, the text appears, and immediately the problem disappears
. What could be the reason for this?

$('#gg').click(function(){
    let gg = $(this).attr('id');
    
   $.ajax ({
       url:'temp/cards.php',
       method:'POST',
       data:{gg:gg},
       success:function(data){
           $('#card').html(data);
       }
   });
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-04-16
@webinar

At you ajax gets from a cycle probably or other script influences. Check how many times this script is connected and how many times jquery is connected. In general, everything is ok with this code, the problem is elsewhere.
Open the console and see what's going on there. If there are endless requests, look to which script sends them.

L
LordPrimes, 2018-04-16
@LordPrimes

Maxim, you are right, the problems were in the router

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question