javascript - Post id from current URL in AJAX to select data from that id
one text
Solution:
You can easily retrieve the id from current url using URLSearchParams()
then use it to create a data object for the ajax
const params = new URLSearchParams(location.search);
const data ={ id: params.get('id')}
$.getJSON('select.php', data, function(response){
// do stuff with response
})
Source