Page 1 of 1

Ajax call running multiple times

Posted: Fri Jan 04, 2013 12:01 am
by Bob Fludder

I am doing an ajax call via custom javascript on an click event. It seems to be sending the request multiple times (up to 8). The routine is not in a loop of any sort that I can see. Any ideas ?


Ajax call running multiple times

Posted: Fri Jan 04, 2013 12:11 am
by maxkatz

As it's custom JavaScript (not Tiggzi generated code) -- it could really be anything.


Ajax call running multiple times

Posted: Fri Jan 04, 2013 12:15 am
by Bob Fludder

Agreed but it only runs on a click event. Surely then the JS thats being called as a result should only run once ? Or is it to do with Ajax and it perhaps trying until the callback is received ? Anyway, thanks I'll do some searching on the web as well.


Ajax call running multiple times

Posted: Fri Jan 04, 2013 12:17 am
by maxkatz

Calldback - if you defined one.


Ajax call running multiple times

Posted: Fri Jan 04, 2013 4:29 am
by Bob Fludder

Found my problem. Code also running on pressing the enter key. Even though I check the keycode (13) once the enter is pressed it then runs for every other key press in that field (happens that I enter 8 characters). Therefore the script ran 8 times... Set up a variable to flag that enter had been pressed so now runs just once.