last day (19 days later) » 

9:36 AM
1
A: Codeigniter ajax insert success redirect

vishalUse if (response.success == true) { // no extra code // url where you want to redirect location.href = "<?php echo base_url('class/function'); ?>"; } in your success function

 
i need the extra code for the validations, so that if the validation fails, then i corrected it, the failed notification will be removed
 
you are handling it in else block
 
not working brother. still stuck in the add page
still not working.
 
is there any error message you're getting?
 
error of Failed to load resource: the server responded with a status of 500 (Internal Server Error)
 
9:36 AM
comment out echo json_encode($data); and $this->index and check again
 
jquery.js:4 POST http://localhost/TLC_HR/Provinces/create 500 (Internal Server Error) still not working brother
adn also
app.min.js:13 Uncaught TypeError: $(...).tooltip is not a function
 
9:49 AM
where you define this $(...).tooltip?
 
i dont know. i always have that error on almost all pages
 
10:07 AM
are you able to save your date successfully
 
yes. the only problem is it is not redirectiong
redirecting*
 
10:27 AM
what you are getting in your ajax resoponse
 
10:41 AM
what ajax response
it just echo
{"status":true}{"PROVINCE":"qwewqeqwe","success":true}
 
why are you geting two separate json
why not like this {"status":true, "PROVINCE":"qwewqeqwe","success":true}
?
 
bec of thiis
$data = array(
'PROVINCE' => $this->input->post('PROVINCE'),
);
$insert = $this->Provinces_Model->save($data);
echo json_encode(array("status" => TRUE));
$data['success'] = true;
i commented the echo json_encode
{"PROVINCE":"wewqewqewq","success":true}
is the output
 
is your :-
this code is working
$('#the-message').append('<div class="alert alert-success">' +
'<span class="glyphicon glyphicon-ok"></span>' +
' Data has been saved' +
'</div>');
$('.form-group').removeClass('has-error')
.removeClass('has-success');
$('.text-danger').remove();
in success function?
 

  last day (19 days later) »