Es wäre großartig, wenn jemand Ajax-Aufrufe mit Jquery erklären und an die Controller-Methode übergeben könnte. Erklären Sie mit einem Syntax BeispielWie übergebe ich Ajax-Aufrufe an die Controller Action-Methode?
// Using the core $.ajax() method
$.ajax({
// The URL for the request
url: "post.php",
// The data to send (will be converted to a query string)
data: {
id: 123
},
// Whether this is a POST or GET request
type: "GET",
// The type of data we expect back
dataType : "json",
})
// Code to run if the request succeeds (is done);
// The response is passed to the function
.done(function(json) {
$("<h1>").text(json.title).appendTo("body");
$("<div class=\"content\">").html(json.html).appendTo("body");
})
// Code to run if the request fails; the raw request and
// status codes are passed to the function
.fail(function(xhr, status, errorThrown) {
alert("Sorry, there was a problem!");
console.log("Error: " + errorThrown);
console.log("Status: " + status);
console.dir(xhr);
})
// Code to run regardless of success or failure;
.always(function(xhr, status) {
alert("The request is complete!");
});
Es wäre toll, wenn jemand kann erklären Ajax JQuery-Anrufe verwenden und dass Verfahren zur Steuerung zu übergeben. Erklären Sie mit einem Syntax Beispiel
Was ist genau das nicht klar? – Vladimirs
Ich möchte wissen, wie Sie Action-Methode in Controller in asp.net mvc mit Ajax JQuery aufrufen. @Vladimirs – raghav
"Syntax Beispiel" - http://www.w3schools.com/php/php_ajax_php.asp für Ajax-Syntax. Schauen Sie sich um –