带有单选按钮值的 jQuery Post
这是我的问题:
我有一个批准页面,供用户向我的网站提交条目。 批准页面对于每个条目都有两个单选按钮(批准或拒绝)。
如何使这些单选按钮将数据库表更新为“已批准”或“已拒绝”?
我有 jQuery,很想使用它和 .post() 函数,只是不确定它是如何工作的。
提前致谢!
更新:我知道我很含糊,这不是故意的。 我不需要 PHP 处理,我只需要知道如何使用 jQuery 将信息提交到我的 PHP 文件。
Here is my question:
I have an approval page for user submitted entries to my site.
The approval page has two radio buttons for each entry (approve or deny).
How can I make those radio buttons update the database table to 'approved' or 'denied'?
I have jQuery and would love to use that and the .post() function, just not sure on how that works.
Thanks in advance!
UPDATE: I understand that I was vague, that is not intended.
I don't need the PHP processing, I just need to know how to submit the information to my PHP file using jQuery.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个模糊的问题,但一般来说,在后端服务器中,您需要设置一个脚本来检查 post 请求的内容,提取必须更新的每条记录的 id,然后在目标上执行更新 sql 语句桌子。
更新
This is a vague question but generally speaking, in your backend server, you need to setup a script that can inspect the content of a post request, extracts the ids of each record that has to update and then perform an update sql statement on the target table.
UPDATE
PHP 会将发布的变量放入 $_POST 超全局变量中,就像用户使用常规旧表单提交功能提交它们一样(假设您的 HTTP 标头格式正确。)您可以使用以输入为键的 $_POST 超全局数组来处理它们元素名称:
PHP will put the posted variable in the $_POST superglobal just as though a user had submitted them with regular old form submit functionality (assuming your HTTP headers are formatted correctly.) You can handle them by using the $_POST superglobal array keyed with the input element's name: