ajax发布成功后重定向到页面

时间:2014-08-26 06:46:28

标签: jquery

我试图在ajax成功之后转到页面而没有任何成功。这是我的代码

$.ajax({
  type: "POST",
  data: {kwargs : le_selected },
  url: baseurl,
  success: function(data){
     var url = "http://localhost/ye/index.php/enterprise/q_qwargs/"+data;    
$(location).attr('href',url);
  }
    });

上面的代码将我带到了http://localhost/ye/index.php/enterprise/q_qwargs页面,并遗漏了data中的值。

这是重定向前的firebug中的postget

enter image description here 我怎样才能将这些数据包括在内?

2 个答案:

答案 0 :(得分:0)

使用此代码

location.href='http://localhost/ye/index.php/enterprise/q_qwargs'+data;

答案 1 :(得分:0)

改变这个,

var url = "http://localhost/ye/index.php/enterprise/q_qwargs/"+data; 
$(location).attr('href',url);