简体   繁体   中英

How do I show my script value from javascript to php

I have a script ( javascript )

<script>
$(function(){
    $(".editagunan").click(function(){
        var id_agunan = $(this).attr("data_id_agunan"); 

        $("#value_id_agunan").val(id_agunan);

        $("#myModalEdit").modal("show");
    });
});
</script>

how to display 'value_id_agunan' from javascript to php

<?php echo id="value_id_agunan" ?>

but the script is wrong, how to fix ? Thanks

Assuming, you are asking on how to write html inside a php file.

Just write HTML directly, like this:

<p id="value_id_agunan"></p> 

If you want to show the above html code on some condition then use php like this:

<?php if(showParagraph){ /* some variable */ ?>
    <p id="value_id_agunan"></p>
<?php } ?> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM