@using (Html.BeginForm(null, null,FormMethod.Post , new {@class="form-horizontal"}))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<button type="submit" class="btn btn-success">
<i class="fa fa-save"></i>
Save
</button>
}
$.ajax({
type: "POST",
url: "Home/EditProfile",
traditional: true,
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(m),
dataType: 'json',
success: function (data) {
if(data == "Hello")
{
alert("Hello");
}
if (data=="error")
{
}
},
error: function (data) { console.log(data) }
});
[HttpPost]
public ActionResult EditProfile(ModelUserProfile m)
{
return Json("Hello");
}
Okay what its return is the following page:
That is "Hello" written on the Blank Page?
But it should gimme alert "Hello". What is wrong?? Note: I am using because of @html.BeginForm()