Over a million developers have joined DZone.

When Creating Dynamic Content With AJAX Don't Forget To...

·
When using AJAX to get data from the server to fill an HTML element, some peolpe find that the AJAX call only works the first time it is executed. If your request returns different data each time there is nothing to worry about but if the server returns the same data twice, nothing will happen on the page the second time. To prevent a null AJAX call you need to clear the HTML element (e.g. 
) that is displaying the data before executing the request.

Data returned from the server

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}