why i have to put extra space in before write option selected because it show error if i don't ' option:selected'

17 Views Asked by At
data: {
      product_id: $(this).data('index'),
      product_quantity: $('#select' + theproductid + ' option:selected').text(),
      csrfmiddlewaretoken:"{{csrf_token}}",
      action:'post'
    },

why in product_quantity where i used option selected i have to put space before option because if i don't put space it show this error

product_quantity = int(request.POST.get('product_quantity'))
ValueError: invalid literal for int() with base 10: ''

can anyone explain.

0

There are 0 best solutions below