Opencart purchase button error

1

When you click the Buy button it does nothing, the following error appears in the console

  

Error: Syntax error, unrecognized expression: #product   input [type = 'text'], #product input [type = 'hidden'], #product   input [type = 'radio']: SELECTED = TRUE, #product   input [type = 'checkbox']: checked, #product select, #product textarea

$('#button-cart').on('click', function() {
$.ajax({
    url: 'index.php?route=checkout/cart/add',
    type: 'post',
    data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:SELECTED=TRUE, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
    dataType: 'json',
    beforeSend: function() {
        $('#button-cart').button('loading');
    },
    complete: function() {
        $('#button-cart').button('reset');
    },

site: www.personaleplantas.com.br

    
asked by anonymous 11.05.2018 / 15:51

1 answer

0

Error is here:

 data:$('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:SELECTED=TRUE, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),

This is not an array, it's not value, it's nothing, you need to extract the values from those fields before, for example:

data:{
    $('#product input[type=\'text\']').val(),
    $('#product input[type=\'hidden\']').val(),
    $('#product input[type=\'radio\']:selected').val(),
    $('#product input[type=\'checkbox\']:checked').val(),
    $('#product select option:selected').val(),
    $('#product textarea').val()
},
    
11.05.2018 / 17:13