0

I'm familiar with writing simple toasts, but I'm trying to create one that displays actual live data back to the user, and I can't find any documentation online for how to do this.

For example, if I have two variables in my function:

var name = "bob";
var favoriteColor = "blue";

Neither of these two options work to incorporate a variable into the toast.

toastr.options = {  
  "positionClass": "toast-top-left"
  }
  toastr.info('Name', name, 'Favorite Color', favoriteColor );  //doesn't work
  toastr.info('Name + name +', 'Favorite Color + favoriteColor');  //doesn't work

  }

What's the proper syntax for doing this?

Brian Powell
  • 3,336
  • 4
  • 34
  • 60

1 Answers1

3

Sorry - must be really early... it's just simple javascript syntax and I was making a typo... the correct answer is

toastr.info('Name' + name, 'Favorite Color' + favoriteColor);

Hope this helps someone else who hasn't had their coffee yet... :)

Brian Powell
  • 3,336
  • 4
  • 34
  • 60