Welcome Guest, Not a member yet? Register   Sign In
AJAX CALL
#1

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 ');
        }
    });
Reply


Messages In This Thread
AJAX CALL - by ignitercode2017 - 02-14-2018, 04:11 AM
RE: AJAX CALL - by Kaosweaver - 02-14-2018, 10:57 AM
RE: AJAX CALL - by ignitercode2017 - 02-15-2018, 01:48 AM
RE: AJAX CALL - by InsiteFX - 02-15-2018, 04:44 AM
RE: AJAX CALL - by ignitercode2017 - 02-15-2018, 06:22 AM
RE: AJAX CALL - by InsiteFX - 02-15-2018, 11:02 AM
RE: AJAX CALL - by ignitercode2017 - 02-18-2018, 01:22 AM
RE: AJAX CALL - by Paradinight - 02-18-2018, 02:59 AM
RE: AJAX CALL - by ignitercode2017 - 02-18-2018, 03:32 AM
RE: AJAX CALL - by Paradinight - 02-18-2018, 05:18 AM
RE: AJAX CALL - by dave friend - 02-18-2018, 10:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB