codeigniter - how can i access this data from my ajax to my controller -


$('#loginform').attr('action', '<?php echo base_url(); ?>index.php/login/identifying_usertype');  var url = $('#signinform').attr('action');  var email = $('#loginemail').val(); var password = $('#loginpass').val();  var postdata = {                 'email' : email,                 'password' : password                 };  $.ajax({                     type: "post",                     url : url,                     data : postdata,                     success: function(response){                          alert(data);                          },                         error: function (xhr, status, error){                             console.log('error', error);                         }                     }); 

i have error on console says uncaught referenceerror: data not defined. when data on postdata array problem on 1 how can access data on controller

this doesn't have controller or of server-side code. have function you're trying use variable doesn't exist:

function(response){     alert(data); } 

the data variable isn't defined anywhere. if you're examining response, surely meant alert response variable instead?:

function(response){     alert(response); } 

of course, if response more primitive value may not show useful results. conversely, can log response console , see more information in browser's debugging console:

function(response){     console.log(response); } 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -