i have trouble to insert data using modal sweet alert, this is my script :
function gettour(){
swal.setDefaults({
input: 'text',
confirmButtonText: 'Next',
showCancelButton: true,
animation: false,
progressSteps: ['1', '2']
})
var steps = [
{
input: 'number',
title: 'Question 1',
text: 'Berapa quantity yang di pesan'
},
{
input: 'text',
title: 'Question 2',
text: 'Tanggal Keberangkatan'
},
]
swal.queue(steps).then(function (result) {
swal.resetDefaults()
swal({
})
}, function () {
swal.resetDefaults()
var qty = result[0];
var tglgo = result[1];
var dataString = 'qty='+qty+'tglgo='+tglgo;
$.ajax({
type:'POST',
data:dataString,
url:'travel.yes/garden/request',
success:function(data) {
alert(data);
}
});
})
};
And this is my Controller
public function request()
{
$qty = $this->input->post('qty');
$tglgo = $this->input->post('tglgo');
$results = $this->model_crud_admin->request_tour($qty,$tglgo);
if($results){
redirect('garden/member_area?auth=tour','refresh');
}
}
Thank you :)
You can do this using stored procedure with codignaitor. Call the SP and just pass sp name and array(model) as parameter.