jquery getting post action url

前端 未结 3 892
感动是毒
感动是毒 2021-02-01 00:23

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

example:

相关标签:
3条回答
  • 2021-02-01 00:45
    $('#signup').on("submit", function(event) {
        $form = $(this); //wrap this in jQuery
    
        alert('the action is: ' + $form.attr('action'));
    });
    
    0 讨论(0)
  • 2021-02-01 00:58

    Try this ocde;;

    var formAction = $("#signup").attr('action');
    
    0 讨论(0)
  • 2021-02-01 01:01

    Clean and Simple:

    $('#signup').submit(function(event) {
    
          alert(this.action);
    });
    
    0 讨论(0)
提交回复
热议问题