I have button, and when I click on it it run ajax that should change "startRow" values', but it doesn't.
Why is that? Here is the code -
<div id="commentsBox">
<?PHP
$startRow = 0;
print_comments ($_GET['page'], $_GET['ownerID'], $startRow)
?>
</div>
<button class="btn btn-primary" id="moreComments" startRow='0' pageName="userPage" refID="<?PHP echo $_GET['ownerID'] ?>">MORE</button>
AJAX:
$(function () {
$("#moreComments").click(function () {
var element = $(this);
var startRow = element.attr("startRow");
var pageName = element.attr("pageName");
var refID = element.attr("refID");
var info = 'startRow=' + startRow + '&pageName=' + pageName + '&refID=' + refID;
$.ajax({
type: "POST",
url: "ajax/moreComments.php",
data: info,
success: function (data) {
$('#commentsBox').append(data);
startRow = startRow + 20;
$("#moreComments startRow").val(startRow);
//element.attr( 'startRow' , startRow);
}
});
return false;
});
});