在laravel html页面上添加javascript代码

在laravel html页面上添加javascript代码,javascript,php,jquery,html,angularjs,Javascript,Php,Jquery,Html,Angularjs,我正在尝试向laravel上的html页面添加“立即付款”按钮,下面是控制器文件PaymentsController.php上的代码 function invoice($id){ $return = array(); $return['payment'] = payments::where('id',$id)->first()->toArray(); $return['siteTitle'] = $this->panelInit->settings

我正在尝试向laravel上的html页面添加“立即付款”按钮,下面是控制器文件PaymentsController.php上的代码

function invoice($id){
    $return = array();
    $return['payment'] = payments::where('id',$id)->first()->toArray();
    $return['siteTitle'] = $this->panelInit->settingsArray['siteTitle'];
    $return['baseUrl'] = URL::to('/');
    $return['address'] = $this->panelInit->settingsArray['address'];
    $return['address2'] = $this->panelInit->settingsArray['address2'];
    $return['systemEmail'] = $this->panelInit->settingsArray['systemEmail'];
    $return['phoneNo'] = $this->panelInit->settingsArray['phoneNo'];
    $return['paypalPayment'] = $this->panelInit->settingsArray['paypalPayment'];
    $return['currency_code'] = $this->panelInit->settingsArray['currency_code'];
    $return['currency_symbol'] = $this->panelInit->settingsArray['currency_symbol'];
    $return['paymentTax'] = $this->panelInit->settingsArray['paymentTax'];
    $return['amountTax'] = ($this->panelInit->settingsArray['paymentTax']*$return['payment']['paymentAmount']) /100;
    $return['totalWithTax'] = $return['payment']['paymentAmount'] + $return['amountTax'];
    $return['user'] = User::where('id',$return['payment']['paymentStudent'])->first()->toArray();

    return $return;
}
下面是发票html页面,我想在其中添加“立即付款”按钮

    <div class="row invoice-info">
        <div class="col-sm-4 invoice-col">
            {{phrase.from}}
            <address>
                <strong>{{invoice.siteTitle}}</strong><br>
                {{invoice.address}}<br>
                {{invoice.address2}}<br>
                {{phrase.phoneNo}}: {{invoice.phoneNo}}<br/>
                {{phrase.email}}: {{invoice.systemEmail}}
            </address>
        </div>
        <div class="col-sm-4 invoice-col">
            {{phrase.tp}}
            <address>
                <strong>{{invoice.user.fullName}}</strong><br>
                {{invoice.user.address}}<br>
                {{phrase.phoneNo}}: {{invoice.user.phoneNo}}<br/>
                {{phrase.email}}: {{invoice.user.email}}
            </address>
        </div>

    <div class="row">
        <div class="col-xs-12 table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>{{phrase.Product}}</th>
                        <th>{{phrase.Description}}</th>
                        <th>{{phrase.Subtotal}}</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>{{invoice.payment.paymentTitle}}</td>
                        <td>{{invoice.payment.paymentDescription}}</td>
                        <td>{{invoice.currency_symbol}} {{invoice.payment.paymentAmount}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <div class="row">
        <!-- accepted payments column -->
        <div class="col-xs-6"></div>
        <div class="col-xs-6">
            <p class="lead"><br/>{{phrase.AmountDue}} {{invoice.payment.paymentDate * 1000 | date:$root.angDateFormat}}</p>
            <div class="table-responsive">
                <table class="table">
                    <tr>
                        <th style="width:50%">{{phrase.Subtotal}}:</th>
                        <td>{{invoice.currency_symbol}} {{invoice.payment.paymentAmount}}</td>
                    </tr>
                    <tr>
                        <th>{{phrase.payTax}} ({{invoice.paymentTax}}%)</th>
                        <td>{{invoice.currency_symbol}} {{invoice.amountTax}}</td>
                    </tr>
                    <tr>
                        <th>{{phrase.Total}}:</th>
                        <td>{{invoice.currency_symbol}} {{invoice.totalWithTax}}</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

{{phrase.from}}
函数payWithPaytest(){
var handler=PaytestPop.setup({
密钥:“公钥”,
电邮:'customer@email.com',
金额:1000,
参考号:“,
回调:函数(响应){
window.location=“”;
},
onClose:function(){
警报(“窗口关闭”);
}
});
handler.openIframe();
}
我这里的问题是如何在javascript代码中将这个值“{invoice.totalWithTax}}”声明为金额。当我尝试使用下面的代码添加它时,它不起作用


函数payWithPaytest(){
var handler=PaytestPop.setup({
密钥:“公钥”,
电邮:'customer@email.com',
金额:{{invoice.totalWithTax}},
参考号:“,
回调:函数(响应){
window.location=“”;
},
onClose:function(){
警报(“窗口关闭”);
}
});
handler.openIframe();
}
 <script src="https://js.paytest.co/v1/inline.js"></script>
          <a href="javascript:;" class="btn btn-md btn-info" onclick="payWithPaytest();"> Pay Via Card </a>
        </div>
    </div>

<script>
function payWithPaytest(){
var handler = PaytestPop.setup({
      key: 'PublicKey',
      email: 'customer@email.com',
      amount: 1000,
      ref: "",
      callback: function(response){
  window.location = "";
},
      onClose: function(){
          alert('window closed');
      }
    });
    handler.openIframe();
  }
</script>