lalnfl Posted April 11, 2011 Share Posted April 11, 2011 Using ajax/jquery: this is the form: <form action="" method="post"> <input type="hidden" id="mem_id" value="<?php echo $id ?>" /> <textarea class="text4" name="chat_message" id="chat_message" style="width: 450px; height: 100px;"></textarea> </div> <div style="width: 120px; height: 100px; float: left;"> <input type="submit" class="submit" value="Submit" /> </form> this is the javascript: $(document).ready(function(){ var chat_message = $("textarea#chat_message").val(); var mem_id = $("input#mem_id").val(); var data = "chat_message=" + chat_message + "&mem_id" + mem_id; $(".submit").click(function(){ $.ajax({url: "chats.php", data: data, type : "POST", dataType: "script"}); }); }); Its not sending it to chats.php, so what am I doing wrong here? Link to comment https://forums.phpfreaks.com/topic/233328-trouble-submitting-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.