javascript - jQuery .html() with PHP embed -


i need add html content page. can this:

$("#followuser").html('<label id="followuser"><button class="btn btn-primary" id="followuserbutton"><i class="fa fa-check"></i> unfollow</button></label>'); 

but need change button text dynamically like

$("#followuser").html('<label id="followuser"><button class="btn btn-primary" id="followuserbutton"><i class="fa fa-check"></i> <?=$lng['2buttonfollow'];?></button></label>'); 

second 1 solution not work. idea? how add php variable jquery?

edit after problem solved: it's echo part. when try use short way of echo makes fail javascript. solution true, changed echo.

you're passing php variable $lng['2buttonfollow']; inside php tags. use echo display value of variable.

$("#followuser").html('<label id="followuser"><button class="btn btn-primary" id="followuserbutton"><i class="fa fa-check"></i> <?php echo $lng['2buttonfollow'];?></button></label>'); 

Comments