How to receive AjaxPOST data in php

Source: Internet
Author: User
How to receive AjaxPOST data in php

Loading contact...

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.