我正在尝试实施一个" post request get"出于SEO原因的模式。因此,我想通过jquery post将值传递给php文件,然后返回一个将用于get 302重定向的url。
我怎样才能访问这些值" prg = ..."从jquery函数里面的链接,以便将它传递给php脚本?
<script type="text/javascript">
$(function() {
$('.redir-link[prg]').click(function (e) {
request = $.ajax({
url: "/app_global/prg.php",
type: "post",
data: {
url: 'test',
url2: 'url2'
},
success: function (response) {
console.log("Hooray, it worked!"+response+this.prg);
window.location = response
},
});
});
</script>
<a prg="val-1|val2" class="redir-link" title="test">PRG Link test</a>