我想使用c#重定向到某個網站。我曾經這樣寫代碼:Response.redirect不在c#中重定向
HTML:
<button id="Buy" class="k-button">Button</button>
腳本:
$("#Buy").live('click', function() {
$.ajax({
url: "/Home/Redirect",
data: JSON.stringify
({
}),
cache: false,
dataType: "json",
success: function (str) {
},
type: 'POST',
contentType: 'application/json; charset=utf-8'
});
});
C#:
public ActionResult Redirect()
{
Response.Redirect("http://www.google.com");
return Json("suc",JsonRequestBehavior.AllowGet);
}
這不會對jQuery的AJAX請求工作。 – 2013-05-02 06:57:00