Clearing an AjaxRequest's data before making another call #293
-
I have an AjaxRequest API caller that gets its url from a StringCompose that is fed a user specified start and end year. On opening my patch, with the start and end years being there from the previous save, the AjaxRequest API call delivers data points, which I then plot, and this works fine. However, while keeping the patch open, if I then change the start or end year (even if it's just a reentry of the previous value) and the AjaxRequest therefore makes another call to the API, the points that it delivers get added to those from the previous call, rather than replacing them. Is there a way of clearing the existing AjaxRequest results prior to it running again? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sorry, my error. The problem wasn't due to AjaxRequest accumulating data with successive calls. The problem was in a user-app later in the chain where I appended data to arrays, and had neglected to empty the arrays when entering the onChange function. |
Beta Was this translation helpful? Give feedback.
Sorry, my error. The problem wasn't due to AjaxRequest accumulating data with successive calls. The problem was in a user-app later in the chain where I appended data to arrays, and had neglected to empty the arrays when entering the onChange function.