Witam,
Mam taki problem:
public ActionResult Index(int? sortedTag)
{
QuotesViewModel quotesViewModel = new QuotesViewModel();
using (var db = DbHelper.GetConnection())
{
quotesViewModel.Quotes = db.Query<QuotesModel>("SELECT * FROM tblQuotes ORDER BY Id DESC").ToList();
if (sortedTag != null)
quotesViewModel.Quotes = db.Query<QuotesModel>($"SELECT * FROM tblQuotes WHERE Tag = {sortedTag} ORDER BY Id DESC").ToList();
}
return View("Index", quotesViewModel);
}
który wywołuję sobie onchange eventem na drop down liście
function filterByTag() {
var selected = $('#ddlTag').val();
var pathname = window.location.pathname;
if (pathname == '/') {
$.ajax({
url: 'Quotes/Index',
type: 'GET',
data: { sortedTag: selected },
success: function () { }
});
};
Nie do końca rozumiem dlaczego widok się nie refreshuje i nie wyświetla pofiltrowanej listy. Debugowałem kod i return View("Index", quotesViewModel); model zwraca pofiltrowaną liczbę rekordów.Pomocy
Dziękuję i pozdrawiam