php - CodeIgniter/jQuery - Ajax call returns full html page instead of my echo -
in view have ajax call:
$(".previous").click(function() { $.ajax({ type: "post", url: "planner/get_cal", data: {current_month: current_month}, success: function(msg){ alert(msg); } }); the get_cal function in planner controller:
function get_cal() { echo "dinosaurs"; } however, instead of returning "dinosaurs", returns full html page. can't figure out why. thoughts? lot.
i solved using leading slash suggested in comments question.
$.ajax({ type: "post", url: "/planner/get_cal", datatype: "text", data: {current_month: current_month}, success: function(msg){ alert(msg); } });
Comments
Post a Comment