如何使用 jq_link_to_remote 通过 POST 提交表单并更新 div?
测试成功.php
<div id="list">
<form name="list" action="<?= url_for('shoppinglist/update'); ?>" method="post">
.
//some input text.
.
<?php
function addlink() {
$linkname = "+";
return jq_link_to_remote($linkname, array(
'update' => 'list',
'url' => 'shoppinglist/update',
'data' => 'list', //this might be the problem.
'loading' => jq_visual_effect('fadeIn', '#indicator'),
'complete' => jq_visual_effect('fadeOut', '#indicator'),
'method' => 'post',
));
}
echo addlink();
?>
<INPUT TYPE="button" VALUE="Cart" onClick="submitForm()">
</form>
</div>
更新
当我使用这个时:
<?php
echo form_remote_tag( array(
'url' => '@shoppinglist/update', // even when I don't type "@“
'update' => 'list',
'loading' => jq_visual_effect('fadeIn', '#indicator'),
'complete' => jq_visual_effect('fadeOut', '#indicator'),
));
?>
错误:调用未定义的函数 form_remote_tag()
当我使用这个时:
function addlink() {
$linkname = "+";
return jq_form_remote_tag($linkname, array(
'url' => '@shoppinglist/update', // even when I don't type "@“
'update' => 'list',
'loading' => jq_visual_effect('fadeIn', '#indicator'),
'complete' => jq_visual_effect('fadeOut', '#indicator'),
'method' => 'post',
));
}
//I just echo a link!
echo addlink();
错误:注意:未定义索引:url in ... JQueryHelper.php 第 353 和 410 行