htaccess的Ajax Post问题

Actually my root htaccess looks

RewriteEngine On
RewriteBase /
RewriteRule ^en/functions/(.*)$ /functions/$1 [NC,L]
RewriteRule ^en/payments/(.*)$ /payments/$1 [NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

The site uses / and /en for multi language. There is a php script in /functions which is called thru Ajax post including variables. On / (main lang) the post is successful on /en the post looks good on debug and the variable seams to be send. But on the php side the variables does not seam to be received. On PHP side the variable will be used with $_POST['my-variable']. The system uses Wordpress.

Ajax Code: jQuery.ajax({ async: false, type: "POST", url: "/functions/pay", data: "bid="+bid+"&amount="+einsatz+"&paysystem="+payeer, success: function(data){ alert("Ok"); }});

PHP Code:

    $bid = $_POST["bid"];
    $paysystem = $_POST["paysystem"];
    $amount = $_POST["amount"];

Any idea why the $_POST Variables are not getting used when posting to /en ?

2020/03/23 08:25
  • php
  • ajax
  • 点赞
  • 收藏
  • 回答