douyun8674 2014-05-27 22:28
浏览 39

可编辑的内联编辑,最近更新的值在页面加载时不显示。 显示默认点击进行编辑

I am using jeditable plugin to update some values in my textarea inline. When I update them the values are processed in a file save.php and the value is stored in a table record in the database and the field is updated.

However my problem is once I have already updated the record and when I load or refresh the page, I cannot see the updated value in the field, the default click to edit is displayed until I click and edit the value in which case it displays the new value. I have read on other posts that the save.php should echo out the value to be displayed in the field.

My save.php code

<?php
 if(isset($_POST['suck'])){
mysql_connect('localhost','root','');
mysql_select_db('inline_database');
$data = $_POST['suck'];
$result = mysql_query("INSERT INTO `form_data` VALUES('','$data')");
$id = mysql_insert_id();
$query = "SELECT * FROM `form_data` WHERE `id` = '$id'";
$retrieve_result = mysql_query($query);

while($row = mysql_fetch_assoc($retrieve_result)){
  $get_id = $row['id'];
}
echo $get_id;
}
?>

My function code which is inside the index.html

 $(".editable_textarea").editable("http://localhost/newedit/save.php", { 
  indicator : "<img src='img/indicator.gif'>",
  loadurl : "http://localhost/newedit/save.php",
  type   : 'textarea',
  submitdata: { _method: "post" },

  //id   : 'elementid',
  //name : 'newvalue',
  select : true,
  submit : 'OK',
  cancel : 'cancel',
  cssclass : "editable",
  tooltip   : "Click to edit ",
  });

My jeditable.js file

var blue =
$.fn.editable.defaults = {
    name       : 'suck',
    id         : 'id',
    type       : 'text',
    width      : 'auto',
    height     : 'auto',
    event      : 'click.editable',
    onblur     : 'cancel',
    loadtype   : 'GET',
    loadtext   : 'Loading...',
    placeholder: 'click to edit',
    loaddata   : {},
    submitdata : {},
    ajaxoptions: {}
};

The Jeditable plugin documentation is here.

And this is the live Demo.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据