I have successfully created an AJAX request using the GET method, passing variables to the URL and receiving a response. Now, I need to retrieve the current URL variables by clicking on a newly created button in order to proceed with further processing. These variables are not visible in the browser's address bar but are included in the AJAX request URL. How can I access these variables upon button click?
function pagi_ajax(records_per_page){
var data = 'action=' + 'testing_ajax' + '&records_per_page=' + records_per_page;
var url_string = window.location.href;
console.log(url_string);
$.ajax({
url: "ajax_pagi.php",
dataType: "json",
type: "get",
data: data,
success: function (result) {
}
});
}
<a href="javascript:void(0)" onclick="pagi_ajax(records_per_page);">Next</a>
<button class="pagi_button" onclick="pagi_ajax( <?php echo $records_per_page; ?>,
<?php echo $rec_limit[$i]; ?>,
<?php echo $total_records; ?>)"> <?php echo $i+1; ?> </button>