我想在帕格模板文件中发送Ajax请求。如何在帕格模板中发送Ajax请求?
form#payment-form()
section
label(for="amount")
input#amount(name="amount" type="tel" min="1" placeholder="Amount" value="10")
script(src="scripts/jquery.js")
script.
(function() {
var amount = $('#amount').val();
$.ajax({
type: "POST",
url: "/posturl",
data: {'amount':amount},
success: function(){},
dataType: 'json'
});
})()
但它不起作用,该怎么办呢? 我想知道如何在哈巴狗文件内嵌的JavaScript发送Ajax请求