php - Ajax call failing to post data on "success" -



php - Ajax call failing to post data on "success" -

i have simple ajax function below onclicking button #submit_message on modal, info sent page (insert_message.php) info entered database , modal reloads. want send value of id recipient_id modal. first part of function works , modal loads perfectly, post info modal not beingness posted - in nil - on firebug info posted insert_message.php, on homecoming nothing. have similar functions other things , these work fine. have searched reply think specific problem, no success. may syntax issue - new jquery.

$("#submit_message").click(function(){ var recipientid = $('#profile_id').val(); var subject = $('#message_subject').val(); $.ajax({ url: '../ajax/insert_message.php', type: 'post', data: { 'subject': $('#message_subject').val(), 'message': $('#message_field').val(), 'recipientid': recipientid, }, success: function(html) { $('.message_holder').load('message_modal.php', {id: recipientid}); $('input[type="text"],text').val(''); $('input[type="text"],textarea').val(''); } }); homecoming false; });

here php file....

if(isset($_post['subject']) && !empty($_post['subject']) && isset($_post['message']) && !empty($_post['message']) && isset($_post['recipientid']) && !empty($_post['recipientid'])){ $message = new message(); $message->subject = ($_post['subject']); $message->message = ($_post['message']); $message->time = strftime("%y-%m-%d %h:%m:%s", time()); $message->sender_id = $_session['sender_id']; $message->recipient_id = $_post['recipientid']; $message->status = "unread"; $message->create(); }

the php file works, , info beingness sent gets database...so running fine. still testing other areas. have odd feeling nil jquery , more modal....lacking inclusion of needed file or something. working on now.....(ps have isset , !empty statements because find occasional unexpected behaviours php in regard.....)

here output - parameters sent , inserted database.....

parametersapplication/x-www-form-urlencoded message message recipientid 162 subject subject source subject=subject+&message=message+&recipientid=162

then console log says.....

(nothing output) scripts_ajax.js (line 66)

no errors reported......still working on it....thanks attention,

bit of mess posting total form here, message_modal.php looks like. thinking @ stage problem here.....

<div id="mymodal" class="reveal-modal-mail"> <p>message <?php echo user::full_name($id);?><p> <?php if(isset($_post['recipientid'])){ //do stuff } ?> <form action="" method="post"> <table> <tr> <td> <input id="message_subject" name="subject" type="text" placeholder="message subject" size="20" maxlength="3000" value=""/> </td> </tr> </table> <table> <tr> <td> <textarea id="message_field" name="message" type="text" placeholder="message details"></textarea> </td> </tr> </table> <input id="submit_message" type="button" name="submit" value="submit" /> <input id="profile_id" type="hidden" name="submit" value="<?php echo $id;?>"/> </form> <a class="close-reveal-modal">&#215;</a>

i found reply , nil unexpected or untoward.

the class 'message_holder' referred in ajax function mispelt on html page.

retarded error.

apologies wasting peoples time

php jquery ajax post

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -