jquery $.post empty array

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

    application/x-www-form-urlencoded
    

    There's your answer. It's getting posted, you're just looking for the variables in $_POST array. What you really want is $_REQUEST. Contrary to the name, $_POST contains input variables submitted in the body of the request, regardless of submission method. $_GET contains variables parsed from the query string of the URL. If you just want submitted variables, use the $_REQUEST global.

    If you expect to be receiving file uploads, than you want to create a new array including the contents of $_FILES as well:

    $arguments = $_REQUEST + $_FILES;

提交回复
热议问题