How To Fix This Json For Loop In Ajax?
Every time when I press the button the button doesn't disappear but it still outputs the contents from the JSON file I love that but when I keep pushing the button more and more. T
Solution 1:
To get rid of the button just add this line above:
document.getElementById("demo").innerHTML = ""; // <- this linevar employees = ...;
This will clear the innerHTML
before adding the employee names.
If you don't want to get rid of the button entirely, you can also hide it:
document.getElementById("bg").style.display = 'none';
Post a Comment for "How To Fix This Json For Loop In Ajax?"