title: pass php variables to javascript function error:missing ) after argument list
body: <p>I try to use XMLHttpRequest() to post data to a url.
  I wrote the following javascript:</p>
  
  <pre><code>function makePostRequest(url, params) {
  var httpRequest = new XMLHttpRequest();
  httpRequest.open("POST", url, true);
  //Send the proper header information along with the request
  httpRequest.setRequestHeader("Content-type", "application/json");
  
  httpRequest.onreadystatechange = function() {//Call a function when the state changes.
      if(httpRequest.readyState == 4 &amp;&amp; httpRequest.status == 200) {
          alert(httpRequest.responseText);
      }
  }
  httpRequest.send(params);}
  </code></pre>
  
  <p>then i need to pass two php variables into this function in php file, one is a url, another is json data to be posted.</p>
  
  <pre><code>$url = "http://www.hello.com";
  $json_str = "{\"format\": \"json\",
            \"event\": \"revert\",
        \"api_key\": \"$wgAPIKey\"}";
  
  $editpage-&gt;editFormTextTop = 
            "&lt;input type='button'value='hello' onclick='makePostRequest(\"$url\", \"$json_str\")' /&gt;";
  </code></pre>
  
  <p>After execution, i got the following error from firebug:</p>
  
  <pre><code>missing ) after argument list
  </code></pre>