[英]Can't Accept Text in jQuery Editable
I am using the following to create a text field with "Ok" and "Cancel" options for entering new text: 我正在使用以下内容来创建带有“确定”和“取消”选项的文本字段,以输入新文本:
$('.edit_area.entry').first().editable('ajax-save-entry.php', {
type : 'textarea',
cancel : 'Cancel',
submit : 'OK',
indicator : '<img src="img/indicator.gif">',
tooltip : 'Click to edit...'
});
I have this in the html: 我在html中有这个:
'<div id="' . $system->systemID . '" class="edit_area entry">' . $system->description . '</div>'
This is ajax-save-entry.php: 这是ajax-save-entry.php:
<?php
if(isset($_POST['id'])){
$system = System::find_by_id($_POST['id']);
if($system){
$system->description = $_POST['value'];
$system->save();
echo $system->description;
} else {
echo "Cannot find a system with that system ID";
}
} else {
echo "No system ID is set";
}
?>
I can type text and cancel it, but clicking "Ok" seems to do nothing. 我可以键入文本并取消它,但是单击“确定”似乎无济于事。 I am not sure if the php code is not running or if it is stopping before there.
我不确定php代码是否未运行或是否在此之前停止。 Any ideas?
有任何想法吗?
EDIT: I am using this plugin . 编辑:我正在使用此插件 。
If you could tell us which plugin you're using, that would be optimal. 如果您可以告诉我们您使用的是哪个插件,那将是最佳选择。 I'm going to assume you're talking about
this one
since it's the most popular/standard (I think). 我想假设您正在谈论
this one
因为它是最流行/最标准的(我认为)。
Anyway, the thing you're missing is a callback function to actually handle what you're echoing onto your php page. 无论如何,您缺少的是一个回调函数来实际处理您在php页面上回显的内容。
$('.edit_area.entry').first().editable('ajax-save-entry.php', {
type : 'textarea',
cancel : 'Cancel',
submit : 'OK',
indicator : '<img src="img/indicator.gif">',
tooltip : 'Click to edit...',
callback : function(data) {
//the data variable will be whatever your php script echoed
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.