简体   繁体   English

在JQUERY / AJAX中使用.html()更新MySQL

[英]Update MySQL with .html() in JQUERY/AJAX

I have some buttons people can click on and when they click on them it gets me what they clicked on as well as their comment. 我有一些人可以单击的按钮,当他们单击它们时,会得到我所单击的内容以及他们的评论。 I usually just pass it on to another page with $_GET but I have a textarea on this one without a form. 我通常只是将其传递给带有$_GET另一页,但是在此页面上我有一个textarea ,没有表单。 How can I use something like below to update a table: 我如何使用类似下面的内容来更新表:

function person_submit() {
    var Name = (".name").html();
    var Job = (".job").html();
    var PickComment = ("comment").val();
}

The mysql update statement is usually something like this in php mysql更新语句通常在php中是这样的

UPDATE table
SET name = ?, job = ?, comment = ?

Use ajax to resolve this issue : 使用ajax解决此问题:

var Name = (".name").html();
var Job = (".job").html();
var PickComment = ("comment").val();

$.ajax({
url: "test.php",
data : {
   name : Name,
   job : Job,
   pickComment : PickComment
 }
 }).done(function() {
   //Do something
 });

More informations here 更多信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM