单击“提交”按钮后继续加载

时间:2015-01-21 14:58:44

标签: javascript php ajax smarty

我有基于php和tpl文件的网站问题,我是php的初学者,但我认为问题是由于javascript或ajax之类的东西。 我添加了一个插件(然后它应该已经完美工作)包括两个文件tpl,一个php文件(用户)和2个php文件(用于管理员端)。 在管理员方面,我有一个设置页面,其中包含要填写的不同表单:当我单击“保存”(类型=“提交”)时,表单中输入的信息应添加到数据库中,而是显示加载图像并无限期地继续。 我不知道它可能取决于什么是应有的或问题,或者它是否依赖于php文件或tpl文件。

我认为问题可能取决于这段代码(我也删除了verifyajax()但问题仍然存在):

if ($input->p['do'] == 'save_settings') {
verifyajax( );
$ht_statistics = $input->pc['ht_statistics'];
$ht_showlastwinners = $input->pc['ht_showlastwinners'];
$ht_lastwinners = $input->pc['ht_lastwinners'];

$ht_profit = $input->pc['ht_profit'];

$ht_win = $input->pc['ht_win'];

$ht_cost = $input->pc['ht_cost'];


if (!is_numeric( $ht_lastwinners )) {
    serveranswer( 0, 'Error: Insert number' );
}


if (!is_numeric( $ht_profit )) {
    serveranswer( 0, 'Error: Insert number' );
}


if (!is_numeric( $ht_win )) {
    serveranswer( 0, 'Error: Insert number' );
}

$upd = $db->query('UPDATE settings SET value=\'' . $ht_statistics . '\' WHERE field=\'ht_statistics\'' );
$upd = $db->query('UPDATE settings SET value=\'' . $ht_showlastwinners . '\' WHERE field=\'ht_showlastwinners\'' );
$upd = $db->query('UPDATE settings SET value=\'' . $ht_lastwinners . '\' WHERE field=\'ht_lastwinners\'' );
$upd = $db->query('UPDATE settings SET value=\'' . $ht_profit . '\' WHERE field=\'ht_profit\'' );
$db->query('UPDATE settings SET value=\'' . $ht_cost . '\' WHERE field=\'ht_cost\'' );
$upd = $db->query('UPDATE settings SET value=\'' . $ht_win . '\' WHERE field=\'ht_win\'' );
serveranswer( 1, 'Settings were updated' );

感谢你给我的帮助,如果问题对你来说是微不足道的话我很抱歉,但作为一个初学者我很难找到,如果你需要我添加组成插件的所有文件。

修改

我尝试通过输入print_r来打印查询,但我找不到任何东西,也许是错误的。

我使用浏览器控制台给了我这些答案: 莫齐拉:

expected 'none' or url but found 'alpha('. error in parsing value for 'filter'. declaration dropped

chrome:

POST http://www.example.com/admin/modules/head_tail.php 404 (Not Found)
                                                jquery.min.js:2 
send                                             jquery.min.js:2
p.extend.ajax                                     jquery.min.js:2
p.(anonymous function)           ?view=addon_modules&module=head_tail:83
addonfrm                         ?view=addon_modules&module=head_tail:126
onsubmit

看到chrome错误控制台我认为问题出在另一个php文件中,这是由于javascript中的这段代码片段:

<script type="text/javascript">
function addonfrm(id){
    $(\'#\'+id).l2block();
    httplocal = \'/admin/modules/head_tail.php\';
    var jqxhr = $.post(httplocal,$("#"+id).serialize(), function(data) {
        if(data.status == 0){
            $("#"+id).l2error(data.msg);
            $("#"+id).l2unblock();
        }else if(data.status == 1){
            $("#"+id).l2success(data.msg);
            $("#"+id).l2unblock();
        }
   }, "json");
    return false;
}
</script>
问题可能是由于.js文件引起的? 我安装了几个附加组件,所有这些都有这个问题。

0 个答案:

没有答案
相关问题