【问题标题】:500 (Internal Server Error) when using ajax in Joomla?在 Joomla 中使用 ajax 时出现 500(内部服务器错误)?
【发布时间】:2013-06-20 01:46:35
【问题描述】:

我想在前端 joomla 网站上使用 Ajax 我在 Joomla 中找到并尝试了一些关于调用 ajax 的代码!但不幸的是它没有运行。 这是我的代码:

文件:components/com_headattack/views/headattackinfo/tmpl/default.php

$("#select-filter1").selectbox({
        onChange: function (val, inst) {

            $('#select-filter2').remove();
            $.post("index.php?option=com_headattack&task=filter1_click&format=raw",
                {
                    elementId : "select-filter1",
                    selectedValue : val
                },
                function(data,status){
                    $('#select_filter_div2').html(data);
                }
            );
        }
    });

文件:components/com_headattack/controllers/headattackinfo.php

public function filter1_click(){
    return "test";
}

当我运行我的网站并单击 select-filter1(combobox) 时,javascript 会抛出一条消息:500(内部服务器错误)

请帮我解决我的问题:(

【问题讨论】:

    标签: joomla2.5


    【解决方案1】:

    您的任务当前映射到组件中的主控制器:components/com_headattack/controller.php

    要让任务在该控制器中运行,您应该调用task=headattackinfo.filter1_click(控制器、句点,然后是函数名称)。

    完整的网址如下所示:

    index.php?option=com_headattack&task=headattackinfo.filter1_click&format=raw

    【讨论】:

      猜你喜欢
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多