I am having problems updating a SPAN in my HTML with the result from a PHP file. In the HTML below the is a link that calls the php file that will update the SPAN above it with the new value.
HTML
<div class="link-votes">
<span id="v<?php echo $link_id; ?>"><?php echo $votes; ?></span>
</div>
<a href="#" class="vote" id="<?php echo $link_id; ?>" name="up" title="Up vote"></a>
PHP
if($_POST['id']) {
$up_value=$row['vote_count'];
$("#v"+id).html(html) = $up_value;
}
If I echo $up_value the right integer is printed. But I cannot update the value in the SPAN.\
Thanks,
You are mixing Javascript code with PHP code. You are using the html() function which looks like it might be from the JQuery library. You might want to echo() in PHP and then use Javascript to work on the return value of that echo() statement. It should work as the echo() will be done before the Javascript takes effect, as is the required flow of execution.