I am not sure if the title of my question is ok. I tried to google it but there is not any topic about it. I am using VS 2017 with MVC project, i have faced two ways to call view (html):
1st way-Using razor methods which is embedded on html views directly
@Html.ActionLink,@Url.Action, etc
2nd-Using Ajax from a JS file
$.ajax({
url: "/Controller/Action",
type: 'GET',
cache: false,
success: function (data) {
$('#Container').html(data);
}
});
I would like to know what the difference is
Ajax.BeginFormand Jquery Json post ? If thats case ` Ajax.BeginForm` and Jquery ajax is same only difference is thatAjax.BeginFormwill create data from ViewModel and in Jquery ajax you have to provide data by yourself.@Html.ActionLink()creates a<a>that makes a redirect.$.ajax()makes an ajax calls which stays on the same page (and in you case updates the DOM)