jquery $.post empty array

后端 未结 5 2101
醉梦人生
醉梦人生 2020-12-19 14:48

I\'m using jQuery to post a form to a php file, simple script to verify user details.

var emailval = $(\"#email\").val();
var invoiceIdval = $(\"#invoiceId\"         


        
5条回答
  •  温柔的废话
    2020-12-19 15:29

    I had a case where I was using jQuery to disable all the inputs (even the hidden ones I wanted) just before using jQuery to submit the form. I changed my jQuery to only disable the "button" type inputs and now the hidden vars are posted when the form is submitted! It seems that if you set a hidden input to disabled its values aren't posted with the form!

    Changed:

    $('input').attr('disabled',true);
    

    to:

    $('input[type=button]').attr('disabled',true);
    

提交回复
热议问题