title: How to pass variable php to javascript?
body: <p>I want to pass the variable from php to javascript therefore i create code like this </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;link rel="stylesheet" href="css/style.css"&gt;
  &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js"&gt;&lt;/script&gt; 
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?PHP
  
   echo "&lt;h2&gt;&lt;a style=\"font-family: 'Raleway', Arial, sans-serif\" class=\"dummy-media-object\"&gt;&lt;p id=\"example2\"&gt;&lt;font face='Raleway' size=\"6\"&gt;http://examle.com&lt;/font&gt;&lt;/p&gt;";
  ?&gt;
  &lt;div id="article"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
  
      $(document).ready(function(){
  
      $.ajax({
          type: "GET",
          url: document.getElementById("example2"),
          contentType: "application/json; charset=utf-8",
          async: false,
          dataType: "json",
          success: function (data, textStatus, jqXHR) {
  
          var markup = data.parse.text["*"];
          var i = $('&lt;div&gt;&lt;/div&gt;').html(markup);
  
          // remove links as they will not work
          i.find('a').each(function() { $(this).replaceWith($(this).html()); });
  
          // remove any references
          i.find('sup').remove();
  
          // remove cite error
          i.find('.mw-ext-cite-error').remove();
  
          $('#article').html($(i).find('p'));
  
  
  
          },
          error: function (errorMessage) {
          }
      });    
  
      });
  
  
  
  
  &lt;/script&gt;
  &lt;h1&gt;
  &lt;/h1&gt;
  
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>in here the  document.getElementById("example2") will be the pass the variable but in this case this is not happening. What i am doing wrong?</p>