jQuery - Redirect with post data

前端 未结 12 1593
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 20:14

How can I redirect with post data?

How to move to new page with $_POST?

How to do this? How is it done and whyfore shall it be done

12条回答
  •  隐瞒了意图╮
    2020-11-28 21:04

    This needs clarification. Is your server handling a POST that you want to redirect somewhere else? Or are you wanting to redirect a regulatr GET request to another page that is expecting a POST?

    In either case what you can do is something like this:

    var f = $('
    '); $('').attr('name', '...').attr('value', '...'); //after all fields are added f.submit();

    It's probably a good idea to make a link that says "click here if not automatically redirected" to deal with pop-up blockers.

提交回复
热议问题