ich eine Ajax-Anfrage wie folgt mache:Aufruf Response.redirect durch Ajax
$(".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;
});
Und in der Server-Seite habe ich einige Code wie folgt geschehen:
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["pid"]))
{
var path = HttpContext.Current.Request.Url.AbsolutePath;
HttpContext.Current.Response.Redirect(path);
}
Ajax POST funktioniert gut. Ich kann in Web Developer Tools in Mozilla sehen, aber Seite wird nicht auf andere Seite umgeleitet, wie ich vermutete. Kann mir jemand sagen, was ich falsch mache?
Oder ist es nicht möglich, Response.Redirect
über Ajax aufzurufen?
Durch die Art und Weise leben ist depreceated, sollten Sie auf http://api.jquery.com/live/ verwenden – adt