I have an ajax call to an external php file "commentS.php" that refreshes every 3 seconds. However. I expected to just use the variable in the hidden input field (name="idd") and expected it to just reflect on the "commentS.php", but, it does not. What I want to achieve is to have the variable "idd" echoed on the "commentS.php" page as a variable to be used in a mysql query. I did the document write on the commentS.php but it just shows a white page with the variable number that is "idd" when the ajax call is made.
<input type="hidden" name="idd" value="<?php echo $row['story_id']; ?>">
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<script type="text/javascript">
var named = "<?php echo $idd; ?>";
$(document).ready(function() {
setInterval(function () {
$('#content').load('commentS.php')
}, 3000);
});
</script>
Any help would be great, a read, anything. I am very new to js and ajax altogether. thanks