I am trying to combine these two functions but my knowledge of Ajax and JS isn't that strong yet and I don't know how i would go about doing it.
$(document).on('click', '.list_item', function() {
var indx = $(this).index();
});
$.ajax({
type: 'POST',
url: 'NavBar.php',
data: {'indx': pat_id},
});
basically I want to send the JS variable indx to the php variable pat_id.
When the user clicks on the li it would be received as something like this.
<li class= "list_item" onclick ="<?php $pat_id = $_POST ['indx']; ?>">
this would all be happening inside the same php file: NavBar.php.