jquery $.post empty array

后端 未结 5 2105
醉梦人生
醉梦人生 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:38

    I tried the given function from Owen but got a blank alert as well. Strange but i noticed it would output a query string and return a blank alert. Then i'd submit again and it would alert with correct post values.

    Also had the field names set in the html using the id attribute (which was how it was done in a jquery tutorial I was following). This didn't allow my form fields to serialize. When I switched the id's to name, it solved my problem.

    I ended up going with $.ajax after all that since it did what I was looking for.

提交回复
热议问题