Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14115

AJAX CALL

$
0
0
hi, 

how to pass an array values to controller function using ajax call

this is my code in the view :

var selected=[];
var i = 0;
 $('#multiselect_to option').each(function(){
     selected[i]=$(this).val();i++;
    });
console.log(selected);

    $.ajax({
        type: 'POST',
        url : 'Book/essailivre',
        data: selected,
        contentType: 'application/json; charset=utf-8',
        datatype: 'json',
        success: function (result) {
            alert('Success ');
        
                          window.location.href="http://............./Book/essailivre"; 

        },
        error: function (result) {
            alert('Fail ');
        }
    });

Viewing all articles
Browse latest Browse all 14115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>