I'm currently passing a laravel object's ID through a href click to a JS function
<a onclick="getDetails('{{$details->id}}')"</a>
And this works to some degree, because my console.log shows id 28 as it should. However, when sending the data in my ajax call my header shows 28: so it's sending the value as the key with a null value, which means my return is null.
How can I properly change this so that this correct value gets sent in my ajax call as ID:28
<script type="text/javascript">
function getDetails(detailID) {
console.log(detailID);
$.ajax({
url: "/details",
data: detailID,
_token: "{{ csrf_token() }}",
type: "POST",
success: function (data) {
console.log(data);
},
});
};
</script>
databe anobject? likedata: {detailID: detailID},?