jQuery获取后操作URL [英] jquery getting post action url

查看:42
本文介绍了jQuery获取后操作URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过jquery函数访问post target操作.

I'm trying to access the post target action in a jquery function.

示例:

<form action="/page/users" id="signup" method="post">

在这种情况下,我想访问操作"部分-"/页面/用户".

I'd like to access the "action" part - "/page/users" in this case.

$('#signup').live("submit", function(event) {
    // get this submitted action
}

似乎我缺少一些非常简单的东西.我在dom中看到了该值,但不知道它在jquery中的存储位置.

Seems like I'm missing something very simple. I see the value in the dom but don't know where it's stored in jquery.

谢谢!

推荐答案

$('#signup').on("submit", function(event) {
    $form = $(this); //wrap this in jQuery

    alert('the action is: ' + $form.attr('action'));
});

这篇关于jQuery获取后操作URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆