I am using toastr and want to set the options with a json object that is returned from ajax call. I am having some trouble setting the options property and value dynamically. Here is sample code:
if(data.toast){
$.each(data.toast, function(index, element) {
toastr.options.index = element;
});
}
And data.toast is a json object that looks like this:
"toast":{"closeButton":true}
Here is what it would look like if I hardcoded it:
toastr.options.closeButton = true;
What should I change the .index in the iterator to so that it will evaluate it as a variable