如何從我提交的表單中將URL作爲「action
」值?從當前表單獲取操作值到jquery自動保存
<form accept-charset="UTF-8" action="/outprojects/save_at/10232" class="edit_user" id="edit_user_10232" method="post">
所以我想jQuery自動保存到這個動作的URL(但它默認爲當前的URL)。
<script type="text/javascript">
jQuery(function($) {
$("form").autosave(
{
callbacks: {
scope: 'all',
trigger: ["change", function() {
var self = this;
$("[name=save]").click(function() {
self.save();
});
}],
save: {
method: "ajax",
options: {
type: 'PUT',
url: this.getAttribute('action')
}
}
}
});
});
給出了錯誤:
類型錯誤:this.getAttribute不是一個函數
如何'$(本).attr( 「行動」);' – tymeJV
這給了錯誤_的SyntaxError :(this).attr('action'); _ – hso