I 've read few tutorials about ajax http request, but somehow i couldn't understand it enough to build a syntax i need.
var path = $(this).data('path');
$.get('http://example.ro/index.php?page=contract.php&path='+path, function(){
});
What i try to achieve is to change url (http://example.ro/index.php?page=contract.php) , without reloading the page,so i can use the path value for later use in a query or some other action,in the same page.But the url doesnt change (it must be with &path=value at the end),so i can't catch the value with something like:
if(isset($_GET['id'])){
/do something
}
Is the syntax wrong? or i cant do it in this way? Help please!
UPDATE
$(document).on('click','tr.listContractRow', function(e){
var path = $(this).data('path');
$.ajax({
type: 'get',
url: 'contract.php',
data: {id: path},
success: function(result) {
console.log(result)
},
error: function() {
}
});
});
The variable path is a value taken from a php content,and i want to take it with ajax and return it back so i can catch it with php.