jQuery - Redirect with post data

前端 未结 12 1614
被撕碎了的回忆
被撕碎了的回忆 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:03

    There is a JQuery plug-in that accomplishes pretty much what you're trying to do: https://github.com/mgalante/jquery.redirect/blob/master/jquery.redirect.js.

    After including JQuery and the jquery.redirect.min.js plug-in, you can simply do something like this:

    $().redirect('demo.php', {'arg1': 'value1', 'arg2': 'value2'});
    

    Use the following code on newer JQuery versions instead:

    $.redirect('demo.php', {'arg1': 'value1', 'arg2': 'value2'});
    

    Hope this helps!

提交回复
热议问题