问题描述:

I assigned an action to my updpunchform jquery dialog:

 $(".punch").click(function(event) {

......

$('#updpunchform').attr('action', '/asistencias/updatePunch/'+$(this).attr("id"));

$updpunch.dialog("open");

...

etc.

-this is what's generated-

<form action="/asistencias/updatePunch/a-77" id="updpunchform" method="post">

<fieldset>

<div style="display: block;" id="anypunchfieldContainter">

...

...

It all works just fine.

Now, before closing my dialog, i need to get the form's action back, such as:

 beforeClose: function( event, ui ) {

// getter

var title = $("#updpunch").dialog( "option", "title" );

return the title string ok.

I've get the form's title but can't figure out how to get its action, tried

var title = $("#updpunch").dialog( "option", "action" ); // ( target, url, href, etc.

and got this text:

[object Object]

How can I get the action of the form as text as shown above? It is on my dom, just can't find out how to get it for further use.

Can you help?

网友答案:

You're probably overthinking it, just ask for the action attribute directly:

var targetUrl = $('#updpunchform').attr('action');
相关阅读:
Top