控制器内部的Joomla ajax调用函数

时间:2019-08-22 18:23:47

标签: php joomla joomla3.0

我正在尝试在控制器内部调用一个函数,该函数将返回回显 但是我的ID #ly-id-result

中显示了结果,但出现错误
{"success":false,"message":"View not found [name, type, prefix]: places, raw, hpj_storemanagerView","messages":null,"data":null}

我的Ajax调用:httpdocs / modules / mod_storemanager_map / tmpl / default.php

var ly_inputVal = document.getElementById("ly-val-inp").value;
jQuery.ajax({
    url: "index.php?format=raw&option=com_storemanager&task=abc",
    data: {text:ly_inputVal},
    method: "POST", //Use post method
    cache: false, //Specify no cache
    success: function(result){
        //console.log(ly_inputVal);
        jQuery("#ly-id-result").html(result);
    }
});

在我的控制器中:httpdocs / components / com_storemanager / controller.php

public function abc() 
{
    // Get Joomla's input object:
    $input = JFactory::getApplication()->input;

    // Get the variable
    $value = $input->get('ly_inputVal');

    return $value;
}

1 个答案:

答案 0 :(得分:0)

我发现了错误;我必须更改

$value = $input->get('ly_inputVal');

$value = $input->get('text');

现在可以正常使用了

相关问题