I would like to pass $recptid = $_GET['id']; To the following
<div id="result"></div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#name').focus();
$('#name').keypress(function(event) {
var key = (event.keyCode ? event.keyCode : event.which);
if (key == 13) {
var info = $('#name').val();
$.ajax({
method: "POST",
//need to pass my get variable
url: "message_action.php",
data: {name: info},
success: function(status) {
$('#result').append(status);
$('#name').val('');
}
});
};
});
});
</script>
Which then executes message_action.php query's as at the moment my error is Undefined variable: recptid . As my query cannot access it due to been in separate file for AJAX
How can I pass $recptid to message_action.php please?