CodeIgniter Forums
jQuery Ajax Function not returning data on success - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: jQuery Ajax Function not returning data on success (/showthread.php?tid=46368)



jQuery Ajax Function not returning data on success - El Forum - 10-29-2011

[eluser]jvk22[/eluser]
I have an ajax function that will not return info on success. When I use firebug, it shows the correct response but when I try to alert the response in the success method it does not work.

Code:
[removed]
$(document).ready(function(){

$("#template_categories").change(function(){
  
      $.ajax({
    type: "POST",
    url: "<?php echo site_url('sign_up/ajax_change_categories'); ?>",
    data: {test:'test'},
    cache: false,
    dataType:'json',
    success: function(html){
     alert('go');
     alert(html);
     if(msg.success){
      var result = msg.message;
      $('#templates').hide();      
      $("#templates").html(result);
      $('#templates').show();
     }
     else
     {
      $('.data').hide();
      //var result = '<td>No Data</td>';
      //$(".ajax_data").html(result);
      alert('No Data');
     }
    }
   });
  
});


});
[removed]