I get the variable in php file: like
$segmentData = $loadData['segment'];
echo $segmentData;
How can I use this value to insert/ append to span element in jQuery?!?!
I tried to place it in span element created in php file, and than extract via ID with jQuery, but didnt work.
I assume there must be better solution to this. EDIT:
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
<span id="segment"> <?php echo $segmentData ;?></span>
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
Please ask me if you need more info