【问题标题】:use variable jquery inside PHP and inside jQuery function在 PHP 和 jQuery 函数中使用变量 jquery
【发布时间】:2017-02-04 02:06:12
【问题描述】:

如果你看到这个功能<?= input_txt('+order_id+') ?>
有 jquery 变量但 jquery 发送错误

function order_status(type, order_id) {
    var value = type.value;

    var info = document.getElementById("cancel_id_" + order_id).value;
    document.getElementById("my_cancel_info").innerHTML = "Determine the reason for cancellation of the order number " + info;
    document.getElementById("cancelled_info").innerHTML = '<?= input_txt('+order_id+') ?>';




    if (value == 2) {
        $('#order_cancelled').modal('show');
    }
}

【问题讨论】:

    标签: php jquery syntax


    【解决方案1】:

    您首先需要了解 PHP 和 javascript 的执行顺序。 PHP 呈现在服务器端,而 javascript 呈现在客户端。我建议您查看http://api.jquery.com/jquery.ajax/,在那里您可以通过 AJAX 将您的 javascript 变量传递给 PHP 脚本,然后返回您的结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多