cant pass php variables to javascript
<p>I'm trying to pass a php variable to a javascript function via the onClick attribute.Heres the piece of code that I have tried but its not working
php Section:</p>

<pre><code>&lt;li id="' . $todo1 . '" class="items"&gt;' . $todo1 . '&lt;button onclick="ajaxdelete(' . $todo1   . ')"&gt;Delete&lt;/button&gt;&lt;/li&gt;
</code></pre>

<p>Javascript function</p>

<pre><code>&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
&lt;script language="JavaScript" type="text/javascript"&gt;

 function ajaxdelete(x){
   var todo = x;
   var hr = new XMLHttpRequest();
   var url = "ajaxtododelete.php";
   var vars = "todo="+todo;
   hr.open("POST", url, true);
   //Random Ajax stuff
   }
</code></pre>
