Welcome Guest, Not a member yet? Register   Sign In
No value in the call back - Jason - Jquery
#1

[eluser]Shiju S S[/eluser]
I have a script that executes on onchange
Code:
<$cript>
var base_url = "&lt;?php echo base_url();?&gt;";
var getValues = function(el, callback)
{
  //callback([{ text : 'test', value : 'test1'}]);
  $.ajax({
  type: "POST",
  url: base_url + "franchisee_lab_investigations/get_patient_details",
  dataType: "jason",
  data: {fields:$("#tags").val()},
  success: function(data) {
    callback(data);
  }
   });

};

$('#tags').change(function()
{
    $('#tags').css('color', '#900');
var output = getValues(this, function () {
  alert(output);
});
  
});
</$cript>

Input tag:
<div class="ui-widget">
&lt;input id="tags" name="textPatientname" class="inp-form" type="text"
placeholder="Search Patient Name or ID..." required &gt;
</div>
Controller

Code:
public function get_patient_details()
{
  $searchterm  = $this->input->post('fields'); // fields comes from ajax
  $franid=$this->session->userdata('franid');

  $data="";

     $query ="SELECT DISTINCT c_patient_name FROM patients_master  order by c_patient_name desc LIMI 1";  

  $result = $this->itc_db->get_results($query);

  if($result)

  {

   foreach($result as $row):

   $data[] = array('id' => $row->c_patient_name, 'label' => $row->c_patient_name, 'value'=> $row->c_patient_name);

    endforeach;    

  }  
  echo json_encode($data); // returns data to the search box
}
I am not getting any value for the var output.


Messages In This Thread
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 09:39 AM
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 09:44 AM
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 09:51 AM
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 09:56 AM
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 10:34 AM
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 11:20 AM
No value in the call back - Jason - Jquery - by El Forum - 02-25-2013, 03:48 PM
No value in the call back - Jason - Jquery - by El Forum - 02-26-2013, 10:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB