I am making an Ajax request like this:
$(".box01 .selproduct").live("click", function(e) {
var color = $(this).parent('.box01').find('.color').val();
var size = $(this).parent('.box01').find('.size').val();
var pid=$(this).parent('.box01').find('.hdinput').val();
var pathname = window.location.pathname;
var data = { submit: "selected",size:size,color:color,pid: pid};
$.ajax({
type: "POST",
url: pathname,
data: data,
success: function(data) {
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
},
complete: function(data) {
}
});
return false;
});
And in the server side I have done some code like this:
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["pid"]))
{
var path = HttpContext.Current.Request.Url.AbsolutePath;
HttpContext.Current.Response.Redirect(path);
}
Ajax POST works fine. I can see in Web Developer Tools in mozilla but page is not redirected to other page as I supposed. Can any one tell me what I am doing wrong?
Or Is it not possible to call Response.Redirect
through Ajax?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…