I want to redirect to a specific site using C #. I wrote the code as:
HTML:
<button id="Buy" class="k-button">Button</button>
Script:
$("#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' }); });
WITH#:
public ActionResult Redirect() { Response.Redirect("http://www.google.com"); return Json("suc",JsonRequestBehavior.AllowGet); }
source share