title: Javascript: How to pass a function with string parameters as a parameter to another function
body: <p>I need to do something like this:</p>
  
  <pre><code>&lt;input type="button" value="click" id="mybtn" 
  onclick="myfunction('/myController/myAction', 
                     'myfuncionOnOK('/myController2/myAction2', 
                                    'myParameter2');',
                     'myfuncionOnCancel('/myController3/myAction3', 
                                    'myParameter3');');"  /&gt;
  </code></pre>
  
  <p>The context of this question is that on the onClick I need to call a javascript function that will make an ajax call to the url I provide. It will open a modal div with OK and Cancel buttons. </p>
  
  <p>Up to here it's fine. But then I also needed to tell the javascript function another function with other parameters and urls to be called when an OK button is clicked in the new div. And another one for the Cancel button.</p>
  
  <p>The problem is I can't manage to pass the second argument properly as it doesn't escape properly and gives me javascript errors.</p>
  
  <p>I have done a search for other similar Javascript questions in SO but non of them seem to cover what I need to do.</p>
  
  <p>Anybody knows how could I pass this kind of string parameters to the javascript function? Or maybe there's another better solution of passing this things that I didn't think of.</p>
  
  <p>Thanks in advance</p>