【发布时间】:2017-03-08 14:55:09
【问题描述】:
我想在 pug 模板文件中发送 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'
});
})()
但是不行,怎么办? 我想知道如何在 pug 文件的嵌入 javascript 中发送 ajax 请求
【问题讨论】:
标签: javascript ajax pug