ali rezultat koi sam dobio izgleda kao na slici
hvala na pomoc
moj kotroler kao argument prima Dictionary<string, object>
controller
Code:
public ActionResult SearchResult(int reportId, Dictionary<string, object> elementValue)
public ActionResult SearchResult(int reportId, Dictionary<string, object> elementValue)
js
Code:
$("#btnSearch").click(function() {
var reportId = $(this).data("id");
var elementValues = [];
$("#pnlFilter :input").each(function () {
if ($(this).attr("type") === "checkbox") {
elementValues.push({ key: this.name, value: $(this).is(":checked") });
//elementValues.push(this.name + "-" + $(this).is(":checked"));
} else {
elementValues.push({ key: this.name, value: this.value });
//elementValues.push(this.name + "-" + this.value);
}
});
alert(elementValues);
$.ajaxSetup({ cache: false });
$.ajax({
type: "POST",
url: "/Report/SearchResult",
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ reportId, elementValues }),
dataType: "json",
success: function () {
//message("Promenite uspešno se sočuvani.", "Izvestuvanje", "info");
var url = "/Report/EditFilters?reportId=" + reportId;
$("#pageContent").load(url);
},
error: function (xhr, status, error) { message("Error: " + error + " " + status + " " + xhr, "Greška!", "error"); }
});
});
$("#btnSearch").click(function() {
var reportId = $(this).data("id");
var elementValues = [];
$("#pnlFilter :input").each(function () {
if ($(this).attr("type") === "checkbox") {
elementValues.push({ key: this.name, value: $(this).is(":checked") });
//elementValues.push(this.name + "-" + $(this).is(":checked"));
} else {
elementValues.push({ key: this.name, value: this.value });
//elementValues.push(this.name + "-" + this.value);
}
});
alert(elementValues);
$.ajaxSetup({ cache: false });
$.ajax({
type: "POST",
url: "/Report/SearchResult",
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ reportId, elementValues }),
dataType: "json",
success: function () {
//message("Promenite uspešno se sočuvani.", "Izvestuvanje", "info");
var url = "/Report/EditFilters?reportId=" + reportId;
$("#pageContent").load(url);
},
error: function (xhr, status, error) { message("Error: " + error + " " + status + " " + xhr, "Greška!", "error"); }
});
});
Kude tumbe i tri bandere