title: Using data from API inside javascript
body: <p>i am using northwind api. Some products i get from api have ' in their name and its a problem because i wanna use it inside of function... I wanna have function buy that sends cost, name of product and quantity per unit, but when I call function i get inside of html</p>
  
  <p><a href="https://i.stack.imgur.com/Uuj1O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uuj1O.png" alt=""></a></p>
  
  <p>Instead of </p>
  
  <p><code>&lt;button onclick='buy(4,"Chef Anton's Cajun Seasoning",22.0000)'&gt;Buy&lt;/button&gt;</code></p>
  
  <p>I tried using single quotes, double quotes, switched between, tried with \' and \" and different variation of ' and " , but nothing seams to work... Here is part of line of code that is troubling me </p>
  
  <pre><code>&lt;button onclick ='buy(" + products.value[j].ProductID + ",'" 
  + (products.value[j].ProductName)+"',"+ products.value.UnitPrice +")'&gt;Buy&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;"
  </code></pre>
  
  <p>also Northwind api I am usin is</p>
  
  <p><code>https://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json</code></p>