title: How can I send two parameters with a HTML onclick event?
body: <p>I have this event that sends the ID parameter to a function that generates a URL, but I want to send two parameters instead of just the ID. I'd like to send the name also.</p>
  <p>With this code I can only send one parameter, but I need to send two.<br />
  Based on <a href="https://stackoverflow.com/q/13585280/1575353">this other post</a> where one parameter is passed, I tried the following:</p>
  <pre><code> '&lt;li id=&quot;link4&quot;&gt;&lt;a href=&quot;#&quot; onclick=&quot;generateURL(\'' + jsonObject.id + '\');&quot;&gt;Line&lt;/a&gt;&lt;/li&gt;'
  </code></pre>
  <p>This is the method that generates my URL</p>
  <pre><code>function generateURL(id, name)
  {
      window.location.href = 'https://www.example'+ id + name + '.com';
   }
  </code></pre>
  <p>In other words I'm trying to imitate this:</p>
  <pre><code>&lt;a href=&quot;#&quot; onclick=&quot;generateURL(jsonObject.id, jsonObject.name)&gt;&lt;/a&gt;
  </code></pre>
  <p>And if I try this:</p>
  <pre><code>'&lt;li id=&quot;link4&quot;&gt;&lt;a href=&quot;#&quot; onclick=&quot;generateURL(\'' + jsonObject.id + ',' + jsonObject.name + '\');&quot;&gt;Line Name&lt;/a&gt;&lt;/li&gt;'
  </code></pre>
  <p>This happens:</p>
  <p><a href="https://i.stack.imgur.com/UoUC3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UoUC3.png" alt="Not receiving the NAME parameter" /></a></p>