Node is saved as draft in My Content >> Draft
-
preventDefault() function in JQuery
In MVC projects or in any .NET projects when we use the controls which are not of pure HTML type the page rendering or postback gets occurred.
So for this we need to make sure that you use the function that will not get your control and data lost when the JQuery function is invoked.
So for doing it we have two ways first we can use preventDefault() function or at last we can return false before the function ends.
First way
$(".lnkEdit").live("click", function (e) {
var id = $(this).attr('id');
url = '@Url.Content("~/Home/_Edit")/' + id;
$("#dialog-edit").dialog('open');
$.get(url,function (result) {
alert(result);
$("#dialog-edit").html(result);
});
$(".ui-dialog-title").html("Update User");
$("#dialog-edit").dialog('open');
return false;
});
Second Way
$(".lnkEdit").live("click", function (e) {
var id = $(this).attr('id');
url = '@Url.Content("~/Home/_Edit")/' + id;
$("#dialog-edit").dialog('open');
$.get(url,function (result) {
alert(result);
$("#dialog-edit").html(result);
});
$(".ui-dialog-title").html("Update User");
$("#dialog-edit").dialog('open');
e.preventDefault();
});
0 Comment(s)