What below is my html code,I wondered if there is a difference between a and button;when I press the a, I can see it does post the request,but the page is still just there,nothing changed.But button does the request and refresh the page.Another strange thing is what I commented can work well.
<html>
<button onclick="nextPage()">test</button>
<a onclick="nextPage()">test</a>
<script>
function nextPage() {
$.ajax({
type: 'post',
url: $('#searchform').attr('action'),
data: {lastRow: $("input[name='lastRow']").val()}
});
/*$("input[name='startRow']").val('');
$('#searchform').submit();*/
return false;
}
</script>
</html>
So can anyone tell the tricks behind this? I appreciate your time.