CodeIgniter - How to return Json response from controller

后端 未结 4 1227
梦谈多话
梦谈多话 2020-12-05 10:15

How do I return response from the controller back to the Jquery Javascript?

Javascript

$(\'.signinform\').submit(function() { 
   $(this).ajaxSubmit(         


        
4条回答
  •  生来不讨喜
    2020-12-05 10:31

    This is not your answer and this is an alternate way to process the form submission

    $('.signinform').click(function(e) { 
          e.preventDefault();
          $.ajax({
          type: "POST",
          url: 'index.php/user/signin', // target element(s) to be updated with server response 
          dataType:'json',
          success : function(response){ console.log(response); alert(response)}
         });
    }); 
    

提交回复
热议问题