将Javascript.append()变量分配给PHP变量

将Javascript.append()变量分配给PHP变量,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我如何将以下Javascipt变量“money”作为PHP变量存储在同一页面上 JS HTML 然后使用$u请求以PHP形式检索值,即 $shipping =$_REQUEST['data-price']; 但是,警报显示我的服务器上随机CSS文件的内容,$\u请求变量数组为空,并返回空/空值 有人能帮忙吗?试试这个,然后做一个var\u dump$\u帖子: 请看一看,因为您显然不了解php和js是如何工作的,这将使事情变得更简单 然后,您可以在此处执行哪些操作,而不是向服务器发送数据,例如

我如何将以下Javascipt变量“money”作为PHP变量存储在同一页面上

JS

HTML

然后使用$u请求以PHP形式检索值,即

$shipping =$_REQUEST['data-price'];
但是,警报显示我的服务器上随机CSS文件的内容,$\u请求变量数组为空,并返回空/空值

有人能帮忙吗?

试试这个,然后做一个var\u dump$\u帖子:

请看一看,因为您显然不了解php和js是如何工作的,这将使事情变得更简单

然后,您可以在此处执行哪些操作,而不是向服务器发送数据,例如:

$("input[name='shipping']").val(money); 

这样,您的隐藏输入将按照您的需要设置值。这就是在客户端使用js所能做的。

谢谢-这真的很有帮助。
<div class="overlay-bg">
      <div class="overlay-content">
          <p>You have selected a country of residence outside of the United Kingdom.</p>
          <p>Please note we only accept credit card payments from UK customers.</p>
          <p>If you are a customer from outside the UK, please click the
          Paypal icon to be taken through to Paypal checkout to complete your order.</p>
          <td width="185" align="center" valign="middle">
            <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
            <input type="hidden" name="cmd" value="_xclick" />
            <input type="hidden" name="business" value="" />
            <input type="hidden" name="item_name" value="" />
            <input type="hidden" name="return" value="" />
            <input type="hidden" name="currency_code" value="GBP" />
            <input type="hidden" name="image_url" value="" />
            <input type="hidden" name="item_name" value="<?=$r['order_title_1']?>" />
            <input type="hidden" name="item_name" value="<?=$r['order_title_2']?>" />
            <input type="hidden" name="item_name" value="<?=$r['order_title_3']?>" />
            <input type="hidden" name="shipping" value="<?=$shipping?>" />
            <input type="hidden" name="amount" value="<?=$r['order_total']?>" />
            <input type="image" src=""
                   name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
            </form>
          <p>However, if you are a UK customer and simply made an error,
          please click below to return to the checkout page.</p>
          <p>Thank you</p>
          <button class="close-btn">Close</button>
        </div>
        </div>
$.post('pay_cart1.php',{'data-price':money},function(result){ alert (result) }
$shipping =$_REQUEST['data-price'];
$.ajax({
    url : "pay_cart1.php",
    type: "POST",
    data : { data-price : money },
    success: function(data, textStatus, jqXHR)
    {
       //if success
    },
    error: function (jqXHR, textStatus, errorThrown)
    {
       //if error
    }
});
$("input[name='shipping']").val(money);