js中的var char无法正常工作

时间:2018-05-07 10:49:43

标签: javascript

因更改而删除此帖子

3 个答案:

答案 0 :(得分:0)

更新后尝试使用' COMMIT'运行查询确认mysql数据库的更新!

答案 1 :(得分:0)

您可以检查值是否到达更新脚本。我认为问题可能出在你的AJAX调用中:

function saveToDatabase(editableObj,column,id) {
            $(editableObj);
            $.ajax({
                url: "saveedit.php",
                type: "POST",
                data:'column='+column+'&editval='+editableObj.innerHTML+'&id='+id,
                success: function(data){
                    $(editableObj);
                }        
           });
        }

在此函数中,您可以通过传递查询字符串来设置数据。您应该使用普通的旧javascript对象而不是查询字符串。

data: {
    column : column,
    editval : editableObj.innerHTML,
    id : id
},

答案 2 :(得分:0)

更改您使用 GET 方法发送数据的Ajax发布数据并尝试通过 POST 方法获取数据



function saveToDatabase(editableObj,column,id) {
  $.ajax({
    url: "saveedit.php",
    type: "POST",
    data: {
      column : column,
      editval : editableObj.innerHTML, // just check it or use $(editableObj).html() if necessary
      id : id
    },
    success: function(data){
      // you will get your response here which is sent from server
    }        
   });
}