i have a jquery Dialog in a partial view:
@model JQueryDialogPoc.Models.FeedBack
@using (Ajax.BeginForm("GiveFeedback", "Home", null, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "emailDialog" }, new { id = "popForm" }))
{
<div class="popUp">
<div>
<ul>
<li>
@Html.EditorFor(x => x.Feedback)
@Html.ValidationMessageFor(x => x.Feedback) </li>
</ul>
</div>
<input type="submit" />
</div>
}
model is:
public class FeedBack
{
[Required]
[Display(Name = "Feedback")]
public string Feedback { get; set; }
}
i Render the partial view like this :
@Html.Partial("MyFeedbackPartialView");
i have this js file which i use to open the dialog:
$("div.popUp").dialog({
title: "",
close: function () {
},
modal: true,
show: "fade",
hide: "fade",
open: function (event, ui) {
$(this).parent().appendTo($('#popForm'));
$(this).load(options.url, function() {
var $jQval = $.validator;
$jQval.unobtrusive.parse($(this));
});
}
});
the actionMethod is :
[HttpPost]
public ActionResult GiveFeedback(string Feedback)
{
return Json(new {result = "Back from Server!"});
}
now the problem is everytime i click on the submit button it redirect the page and show me this :
{"result":"Back from Server!"}
although it supposed to make ajax request !
any idea why this is happening ?