Call a function each time data is retrieved via AJAX
Call a function each time data is retrieved via AJAX
My code receives its data via AJAX. Some of this data is used to plot markers on a Google Map. Each time the data is reloaded (e.g. via a sort or filter function) I would like to clear all the current map markers (as otherwise they get drawn twice).
I looked at the available callback functions, but none of them seem appropriate since fnDrawCallback is called after all the data has been drawn and would clear the map too late, and fnPreDrawCallback appears to have the same issue.
I can of course call my marker clearing function every time I call a filter fnFilter, but I was just wondering if there was some clean way I could call it just the once.
Thanks in advance.
I looked at the available callback functions, but none of them seem appropriate since fnDrawCallback is called after all the data has been drawn and would clear the map too late, and fnPreDrawCallback appears to have the same issue.
I can of course call my marker clearing function every time I call a filter fnFilter, but I was just wondering if there was some clean way I could call it just the once.
Thanks in advance.
This discussion has been closed.