title: How to include value from php file into jQuery and place it into span element?
body: <p>I get the variable in php file: like </p>
  
  <pre><code>$segmentData = $loadData['segment'];
  echo $segmentData;
  </code></pre>
  
  <p>How can I use this value to insert/ append to span element in jQuery?!?! </p>
  
  <p>I tried to place it in span element created in php file, and than extract via ID with jQuery, but didnt work.</p>
  
  <p>I assume there must be better solution to this.
  <strong>EDIT:</strong></p>
  
  <p>I am using it with ajax call with WP. I got in callback function requested data, but now I want to display that data in div or span on the fronted. 
  So far, I have made span </p>
  
  <pre><code>&lt;span id="segment"&gt; &lt;?php echo $segmentData ;?&gt;&lt;/span&gt;
  </code></pre>
  
  <p>and in js on click get value of id "segment", and than append, but I dont wanna to make html element in php file, and this one that I tried didnt retrieve me value</p>
  
  <p>Please ask me if you need more info</p>