I am new to mvc I have this AJax and Controller,
i need to return a view that say "Email Sent"
for now the controller redirected me to the
http://localhost:1365/?Name=as&Adress=adsads&city=a&state=as&zip=as&phone=asas&Message=a
Ajax Call
<script>
$(function () {
$("#JqAjaxForm").submit(function () {
debugger;
var sdata = $("#JqAjaxForm").serialize();
alert(sdata);
senddata = { "daye": sdata };
$.ajax({
url: '/Email/emaildata',
async: false,
type: "POST",
data: JSON.stringify(senddata),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function (jqXHR, textStatus, errorThrown) {
alert("FAIL: " + errorThrown);
},
success: function (data, textStatus, jqXHR) {
alert("Email Sent");
}
});
});
});
</script>
Controller
// GET: /Email/
public ActionResult emaildata(string Daye)
{
var a = Daye;
return View();
}