Bibek
Bibek

Reputation: 61

How to show inner html in ajax?

<script>
    $(document).ready(function(){
        $("#tender").on("change",function(){
            var data = $("#tender").val();
            $.ajax({
                url     : "tender.php",
                data    : {type: data,total: <?php echo $realfinaltotalprice ?>},
                type    : 'post', 
                success : function(result){
                    $("#tenderHint").val(result);
                }
            });
        });
    });
</script>

I am trying to get the result in inner html. I tried with $("#tenderHint").val(result); to $("#tenderHint").innerHTML(result); but it is not working. How can I make inner html work on this AJAX code. Thanks in advance.

Upvotes: 1

Views: 173

Answers (2)

Andi AR
Andi AR

Reputation: 2918

You can show the inner html by setting html to the targets like below.

$("#tenderHint").html(result);

Upvotes: 0

krivtom
krivtom

Reputation: 24916

Use html method Just change

$("#tenderHint").val(result);

to

$("#tenderHint").html(result);

Upvotes: 3

Related Questions