the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/

我正在使用的jquery插件是这个http://code.google.com/p/jquery-in-place-editor/

if i have a table like this

如果我有这样的桌子

<table>
<thead>
<tr>
<th>id</th>
<th>first name </th>
<th>last name </th>
</tr>
</thead>

<tbody>
<tr>
<td class="id">1</td>
<td class="fname">sarmen</td>
<td class="lname">mikey</td>
</tr>

<tr>
<td class="id">2</td>
<td class="fname">john</td>
<td class="lname">angelo</td>
</tr>

<tr>
<td class="id">3</td>
<td class="fname">sarmen</td>
<td class="lname">grande</td>
</tr>
</tbody>
</table>

and my js looked something like this

我的js看起来像这样

$("td.fname").editInPlace({
    url: 'ajax.php',
    params: '',
    show_buttons: true          
});

then lets say i click on the first record to edit it which is fname of sarmen. how can i pass a param that only accociates id 1 ? because if i do a query of lets say

然后让我说我点击第一条记录来编辑它,这是sarmen的fname。我怎样才能通过一个只能跟踪id 1的param?因为如果我做一个查询,让我们说

"update tbl_users set fname = '$_POST['update_value']' where fname = '$_POST['original_html']'"

(note: im just showing an example so no need to clean posts if that was bothering you :) )

(注意:我只是展示一个例子所以如果那困扰你就不需要清理帖子:))

if i run this query the fname of sarmen will update in two records rather than one. How can i only update to id of 1 being to update only one record.

如果我运行此查询,sarmen的fname将更新为两个记录而不是一个。我怎样才能更新为1的id只更新一条记录。

2 个解决方案

#1


1

$("table tr").each(function(i, el) { 

   var tdId = $(el).find("td.id");

   $(this).find("td.fname".editInPlace({
       url: 'ajax.php',
       params: 'id=' + $(tdId).text(),
       show_buttons: true              
    });

});

更多相关文章

  1. weiphp插件开发注意
  2. 如何将Composer中的CakePHP插件安装到app / Plugin中
  3. jQuery通过igorescobar jQuery掩码插件验证电话号码输入。
  4. Javascript语法中null与“”的误写导致长期困扰的问题终于解决了
  5. 记12306货运系统“抢订空车”插件的编写--订车流程梳理
  6. 超全超实用的Javascript类库和jQuery插件大全之一:图片,地图和图形
  7. 高性能JavaScript代码高亮插件
  8. javascript-cropper插件翻译笔记
  9. VS2010常用插件介绍之Javascript插件

随机推荐

  1. 隐藏的数字咪咪
  2. android 抖动原理
  3. android利用Handler开启线程和关闭线程
  4. Android(安卓)定制RadioButton样式
  5. Android(安卓)文件下载三种基本方式
  6. as android 打包
  7. Android(安卓)打开Gallery
  8. 使用代码为textview设置drawableLeft
  9. Android渲染器Shader:环状放射渐变渲染器R
  10. Android - DownloadManager的使用