$(function(){
var ref=document.referrer;var url=document.URL;alert(url);
$.ajax({
type:'GET',
url:'/axphp/ax/core/from.php?ref='+ref+'&url='+url+'&num='+Math.random(),
success:function(msg){
// alert(msg);
},
error:function(){alert('error');}});});这里的 url 实际是: http://192.168.1.32/gongsiyou/?uid=1&ad=13&stn=mjalert(url) 也是这个值,但是到了 from.php 里没做任何处理就变成了: http://192.168.1.32/gongsiyou/?uid=1这是何故?
var ref=document.referrer;var url=document.URL;alert(url);
$.ajax({
type:'GET',
url:'/axphp/ax/core/from.php?ref='+ref+'&url='+url+'&num='+Math.random(),
success:function(msg){
// alert(msg);
},
error:function(){alert('error');}});});这里的 url 实际是: http://192.168.1.32/gongsiyou/?uid=1&ad=13&stn=mjalert(url) 也是这个值,但是到了 from.php 里没做任何处理就变成了: http://192.168.1.32/gongsiyou/?uid=1这是何故?
encodeURIComponent(url)
或是
escape(url)试试吧
encodeURIComponent(url)
或
escape(url)
试试吧
这里写的有问题,url每遇到一个&就认为是一个参数,所以你的url这个参数在第一个&之后的就没有用了。
向楼上说的可以进行编码后传值。