hi
How to call javascript in controller on Net.Core
its working like below in MVC
@using (Html.BeginForm("Goo", "Respond", null, FormMethod.Post))
{
<input type="submit" value="Redirect" class="btn btn-primary mt-5 ml-5" id="btnGo" name="btnGo" />
}
[Microsoft.AspNetCore.Mvc.HttpPost]
public ActionResult Goo()
{
return Redirect("http://www.google.com");
}
But Net.Core doesn't know the syntax
[HttpPost]
public JavaScriptResult Goo()
{
return JavaScript("window.location.href = http://www.google.com");
}
$.ajax({
url: "/Respond/Goo",
type: 'POST'
cache: false,
contentType: false,
processData: false
});