I'm trying to call a controller action from javascript to get data in json format. I guess it should be pretty clear using $.getJSON
function. But it doesn't work in my code. Is there anyone who can explain me what is wrong?
IndexController action
public function jsonAction()
{
$this->_disableView();
$data[0]["name"] = "test";
$data[0]["lat"] = 50.080746;
$data[0]["long"] = 14.426373;
echo json_encode($data);
}
When I test it on url domain/index/json I see json as expected. Now the relevant script in document ready function:
$.getJSON("index/json",function(data){
alert("hello");
});
But no alert is shown. In the console I can see
Uncaught TypeError: jQuery(...).asmSelect is not a function