How to receive AjaxPOST data in php
Ctrl+EnterSend
/*** Send information/obtain information * // clear the timer function clearChatTimers (id) {if (id) {// execute if (aPChatTimers [id]) {clearTimeout (aPChatTimers [id]); loadFlag = false; // console. log ('clear: '+ aPChatTimers [id]) ;}} else {// perform for (var I = 0; i0) regularly except all users) {var _ scrollHeight = $ ('. dialog-comment-list '). find ('Lil '). last (). offset (). top; $ ("# post-reply "). closest ('. site-im-dialog '). find ('. dialog-comment-list '). animate ({zoom: 1}, function () {$ (". dialog-comment-list-box "). data ('JSP '). scrollTo (0, _ scrollHeight) ;}; ("# post-reply "). removeAttr ('disabled '); clearInputMessage (); clearChatTimers (0); getPrivateMessages (uid);} else {tipsOp (json. msg, 'error'); $ ("# post-reply "). removeAttr ('disabled ') ;}, 'json ');}
{"Msg": "\ u53d1 \ u9001 \ u6210 \ u529f", "status": "1", "data": []}
Click Send or Ctrl + Enter to not lift ()
How can I click the send button or press CTRL + ENTER to POST data to php and request PHP code?
Reply to discussion (solution)
What is your code? why can't the backend get it? To be specific.
What is your code? why can't the backend get it? To be specific.
Php cannot get
What is your code? why can't the backend get it? To be specific.
HTML code
Send
// Send message function sendPrivateMessages () {var uid, message; uid = getRecipientIdFromReplyBtn (); message = getInputMessage (); if (message = false) {$ ('. for-post '). popover ('Show '); $ ("# edit "). focus (function () {$ ('. for-post '). popover ('hide ') ;}); return false ;}$ ("# post-reply "). attr ('disabled ', 'disabled'); // after the button is clicked, the clearChatTimers (0) is disabled by disabled; // index. php? Do = webim & action = send_messages POST to backend processing // php returns json data {"msg": "\ u53d1 \ u9001 \ u6210 \ u529f", "status ": "1", "data": []}/* I really don't know how php Gets post data */$. post ('index. php? Do = webim ', {action: 'Send _ messages', uid: uid, sMessage: message}, function (json) {if (json. status = '1') {if ($ ('. dialog-comment-list '). find ('Lil '). length> 0) {var _ scrollHeight = $ ('. dialog-comment-list '). find ('Lil '). last (). offset (). top; $ ("# post-reply "). closest ('. site-im-dialog '). find ('. dialog-comment-list '). animate ({zoom: 1}, function () {$ (". dialog-comment-list-box "). data ('JSP '). scrollTo (0, _ scrollHeight) ;}; ("# post-reply "). removeAttr ('disabled '); clearInputMessage (); clearChatTimers (0); getPrivateMessages (uid);} else {tipsOp (json. msg, 'error'); $ ("# post-reply "). removeAttr ('disabled ') ;}, 'json ');}
Run $. post ('index. php? Do = webim ', {action: 'Send _ messages', uid: uid, sMessage: message }...
Php get
$ _ GET ['do '] is webim
$ _ POST ['action'] is send_messages
$ _ POST ['uid'] indicates the uid value.
$ _ POST ['smessage'] indicates the value of message.
Run $. post ('index. php? Do = webim ', {action: 'Send _ messages', uid: uid, sMessage: message }...
Php get
$ _ GET ['do '] is webim
$ _ POST ['action'] is send_messages
$ _ POST ['uid'] indicates the uid value.
$ _ POST ['smessage'] indicates the value of message.
Thanks. I thought action was the GET parameter.