I have a function that toggles a button: now I would like to display the text next to the button in 2 different colors based on the response.
This is my code:
function toggleMustHave(){
$.ajax({
type: "POST",
dataType: "json",
url: '{$ajaxUrl}&act=toggleMustHave',
data: 'storeId={$storeId}',
success: function(data){
$('#mustHave').html('<span id="mustHave" >'+data['mustHaveButtonText']+ ' --> '+'</span>');
$('#mustHaveButton').text(data['mustHaveButtonText']);
}
});
}