I am trying to return json from a module method. Very simple example at this point.
public function mealDates()
{
echo "{\"foo\" : \"bar\"}";
}
From the template
$.ajax({
//request dates that are already taken
type: "POST",
url: "ACT=79",
success: function(json){
console.log(json);
},
error: function(e){
}
});
If I declare dataType: 'json' returns error. If I don't I still am not getting the {"foo" :"bar"} from method. Suggestions on how to return json to template?
Thanks