function func1(a,b) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("test").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","includes/funkcije.php?min="+a+"&max="+b,true);
xmlhttp.send();
I have tried to make something but it doesn't work. It just puts me at the top of the page
$('#page-01').ajax({
type: "GET",
url: "includes/funkcije.php",
data: "min=0&max=10",
success: function(data) {
$('#test').text(data);
}
})
$('#page-02').ajax({
url: "includes/funkcije.php",
data: "min=10&max=20",
success: function(data) {
$('#test').text(data);
}
})
these are the links that I press to execute func1
<li><a id="page-01" href="javascript:func1(0,10)">1</a></li>
<li><a id="page-02" href="javascript:func1(10,20)">2</a></li>
This is made to list pages of posts on my site Tristann.tk. Can someone please help me with this or tell me a better way to make those pages?
I fixed it with this code:
$(document).ready(function(){
$('#page-01').on('click', function () {
$.ajax({
type: "GET",
url: "includes/funkcije.php",
data: "min=0&max=10",
success: function(data) {
$('#test').html(data);
}
});
});
$('#page-02').on('click', function () {
$.ajax({
type: "GET",
url: "includes/funkcije.php",
data: "min=10&max=20",
success: function(data) {
$('#test').html(data);
}
});
});
});
and the links are like this:
<a id="page-01" href="javascript:void(0)">1</a>
<a id="page-02" href="javascript:void(0)">2</a>
$.ajaxapi.jquery.com/jQuery.ajax