Changing the action of a form with JavaScript/jQuery

后端 未结 6 804
借酒劲吻你
借酒劲吻你 2020-11-29 19:40

I\'m having an issue that is driving me crazy. I\'m trying to modify the openid-selector to support facebook. I\'m using RPXNow as my provider so it requires the form to be

6条回答
  •  Happy的楠姐
    2020-11-29 20:35

    You can actually just use

    $("#form").attr("target", "NewAction");
    

    As far as I know, this will NOT fail silently.

    If the page is opening in a new target, you may need to make sure the URL is unique each time because Webkit (chrome/safari) will cache the fact you have visited that URL and won't perform the post.

    For example

    $("form").attr("action", "/Pages/GeneratePreview?" + new Date().getMilliseconds());
    

提交回复
热议问题