Jump to content

Trouble submitting form


lalnfl

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.