Skip to content Skip to sidebar Skip to footer

Ajax Request Doesn't Work The First Time But Works Thereafter

I'm making a simple function as it is shown on w3schools official website. I'm trying to run a function of an AJAX request. I guess it's all working well except the fact that the c

Solution 1:

actually very simple:P your button is default attribute 'type' of "submit" and when that happens, the form gets submitted causing a refresh. Add 'type="button"' to change this functionality and you should not have a refresh anymore allowing the ajax to finish its request.


Post a Comment for "Ajax Request Doesn't Work The First Time But Works Thereafter"