我正在尝试在jquery函数中访问post目标操作.
例:
<form action="/page/users" id="signup" method="post">
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我想访问"action"部分 - "/ page/users".
$('#signup').live("submit", function(event) {
// get this submitted action
}
Run Code Online (Sandbox Code Playgroud)
好像我错过了很简单的东西.我在dom中看到了值,但不知道它在jquery中的存储位置.
谢谢!
Amy*_*y B 115
$('#signup').on("submit", function(event) {
$form = $(this); //wrap this in jQuery
alert('the action is: ' + $form.attr('action'));
});
Run Code Online (Sandbox Code Playgroud)
Vik*_*wal 15
试试这个ocde ;;
var formAction = $("#signup").attr('action');
Run Code Online (Sandbox Code Playgroud)
Fer*_*ehy 10
干净简单:
$('#signup').submit(function(event) {
alert(this.action);
});
Run Code Online (Sandbox Code Playgroud)