optiltsitle
New Member
The JS is where im struggeling im trying to send the textarea containing the msg_id to the PHP:\[code\]var comments = {}comments.fetchMessages = function () { $.ajax({ url: 'ajax/comments.php', type: 'post', data: { method: 'fetch' }, success: function(data) { $('.comments .comment').html(data); } });}comments.throwMessage = function (message) { if ($.trim(message).length != 0) { $.ajax({ url: 'ajax/comments.php', type: 'post', data: { method: 'throw', message: message}, success: function(data) { comments.fetchMessages(); comments.entry.val(''); } }); }}comments.throwID = function (msg_id) { if ($.trim(msg_id).length != 0) { $.ajax({ url: 'ajax/comments.php', type: 'post', data: { method: 'throw', msg_id: msg_id}, success: function(data) { e.preventDefault(); } }); }}comments.entry = $('.comments .entry');comments.entry.bind('keydown', function(e) { if (e.keyCode === 13 && e.shiftKey === false) { comments.throwID($(this).val()); comments.throwMessage($(this).val()); e.preventDefault(); }});comments.interval = setInterval(comments.fetchMessages, 60000);comments.fetchMessages();\[/code\]Here is where the form is, you see the last textarea there is the id from my news id, i need it to connect the comment and the news:\[code\]echo '<form method="POST"><div class="shoutbox_form"><textarea class="entry" cols="27" placeholder="Type here and hit Return. Use Skift + Return for a new line" maxlength="250"></textarea><textarea class="entry1" name="msg_id">'.$id.'</textarea></div></form>';\[/code\]Here is all the PHP that sending it to another file that again send it to my db.\[code\]else if($method === 'throw' && isset($_POST['message']) === true) { $msg_id = $_POST['msg_id']; $message = trim($_POST['message']); if (empty($message) === false) { $chat->throwMessage($session->userinfo["username"], $message, $msg_id, time()); } }\[/code\]i can't get the $_POST['msg_id'] from the javascript in the php file.