I have a php page that have $id=$_GET['id'];
I want to make a select box that when you click on some option will reload the page (with the GET + a new value number in post).
I did that:
function test(){
var id="<?= $id?>";
$("#box").bind("change", function() {
var val = $(this).val();
$.ajax({
url: '/somepage.php?id='+id,
type: 'POST',
data: {f: val}
});
});
}
Now its don't do anything (or do and i dont see it..)
If you want to reload page then why do you need Ajax assuming $id is your $_GET['id'] do this
function test(){
var id="<?= $id?>";
$("#box").bind("change", function() {
var val = $(this).val();
var newVal = parseInt(val)+parseInt(id);
window.location.href='somepage.php?id='+newVal;
});
}