I'm looking to pass multiple values with ajax.
My Code:
$(".ajax-button").change(function(event){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
$.ajax({
url:'{{action("WebshopController@refreshCheckout")}}' ,
data: {
frame: $('input.frame:checked').val(),
color: $('input.color:checked').val()
},
method: 'GET'
}).done(function(response){
console.log(response);
});
});
As you can see im trying to send a frame and a color:
data: {
frame: $('input.frame:checked').val(),
color: $('input.color:checked').val()
},
However it does not combine these 2, when I click the checkbox for frame it only sends the frame: and when I click checkbox for color is only sends the color. as seen in the printscreen below.
I want it to build the URL like: refreshCheckout?color=Silver&frame=h35
How do I achieve this?
Help is appreciated.
