Iam using MVC4, i want to post my page from client to server, iam using ajax post method to post my submit my data.
$("#btn").click(function(){
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '/Admin/Create/',
//data: JSON.stringify(datatosend),
crossDomain: true,
dataType: "json",
success: function (data) {
if (data.redirectUrl != null) {
window.location = data.redirectUrl;
}
})
});
Here instead of <input type="submit" value="add"> am using <input type ="button" value="add" id="btn">
and on click method to call ajax post.
When am using submit type, validation are working fine, but on button type vaidations are not working and page is not redirecting after success also.
I have seen lot of posts regarding this issue. But not able to find out the reason