I have a response from an AJAX request and depending upon the situation that calls it, I want to either replace the data on the screen, or append new data to the screen.
Two possibilities are as followed:
$('#data').append(response);
$('#data').html(response);
I tried to do something like:
var action = "append"
$('#data').(action)(response)
That didn't work, how can I do this?