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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -