How do I set the value/text of a div
?
<div id="numberOf"></div>
$("#btn").click(function (event) {
$.getJSON('http://host/myServiceImpl.svc/GetCount?method=?',
{ id '1' },
function (data) {
alert(data);
$("#numberOf").val = data;
}
);
});
Text: http://api.jquery.com/text/
$("#numberOf").text(data);
Html: http://api.jquery.com/html/
$("#numberOf").html(data);
^ Google gives you everything you need. I would suggest googling before asking.
So to answer, you'd want
$('#numberOf').text(data)
or
$('#numberOf').html(data)
or
$('#numberOf').html(data);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With