我有一个输入type =“button”
<input type="button" name="DeleteJob" runat="server" value="Löschen" onclick="DeleteJob()" />
和JavaScript方法:
function DeleteJob() {
if (confirm("Do you really want to delete selected job/s?"))
return true;
else
return false;
}
我该如何返回true,重定向到Action DeleteJob?
[HttpGet]
public ActionResult DeleteJob(string selectedObject)
{
return View();
}
最佳答案
要重定向:
function DeleteJob() {
if (confirm("Do you really want to delete selected job/s?"))
window.location.href = "your/url";
else
return false;
}
关于c# - 如何从JavaScript方法重定向到操作?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5336858/