1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
//Suppression d'une ligne et rechargement de la grille complète par AJAX
function RemoveRow(rowId) {
$.ajax(
{
type: "POST",
url: "/Home/RemoveRow",
context: $("#DetailsGrid"),
data: "rowToRemove=" + rowId,
success: function (data) {
$(this).html(data);
}
}
);
}
//Trouvé sur Internet, Post Ajax de tout le formulaire.
//En l'état ne fonctionne pas avec un objet fils de type collection.
$(function () {
// Initialize progress dialog ...
$("#ProgressDialog").dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
title: "Loading",
closeOnEscape: false,
open: function () { $(".ui-dialog-titlebar-close").hide(); } // Hide close button
});
// Handle form submit ...
$("form").live("submit", function (event) {
event.preventDefault();
var form = $(this);
$("#ProgressDialog").dialog("open");
$.ajax({
url: form.attr('action'),
type: "POST",
data: form.serialize(),
success: function (data) {
$("#FormContainer").html(data);
$.validator.unobtrusive.parse("form");
},
error: function (jqXhr, textStatus, errorThrown) {
alert("Error '" + jqXhr.status + "' (textStatus: '" + textStatus + "', errorThrown: '" + errorThrown + "')");
},
complete: function () {
$("#ProgressDialog").dialog("close");
}
});
});
}); |
Partager