我正在尝试在控制器内部调用一个函数,该函数将返回回显
但是我的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;
}
答案 0 :(得分:0)
我发现了错误;我必须更改
$value = $input->get('ly_inputVal');
到
$value = $input->get('text');
现在可以正常使用了