Welcome Guest, Not a member yet? Register   Sign In
Unable to get Response from ajax
#1

[eluser]Gukkie[/eluser]
Hi, i have a small problem here which i cannot fix, i am trying to get a rsponse from an ajax call to the controller function. The post goes through but the response returns a "500 internal server error"

Why is this so? What am i doing wrong?

JS:
Code:
function getState(countryId)
{
var dataString = "countryId="+countryId;

$.ajax({
  type: "POST",
  url : baseUrl + 'user/getState',
  data: dataString,
  cache : false,
  success : function(response){
   alert(response);
   }
});
}

Controller:
Code:
function getState()
{
  if($this->input->is_ajax_request())
  {
   $countryID = $this->input->post('countryId');
  
   echo $countryID;
  }
}




Theme © iAndrew 2016 - Forum software by © MyBB