Hi,
I am using select2 to retrieve data from remote data source using S2 ajax but the problem is that data is loaded only once so when i search for another term it doesn’t connect to the server and only searches in the old data.
Here is my Api
[HttpGet]
[Route(“GetItemsWithParam/{term}”)]
public IHttpActionResult GetItemsWithParam(string term)
{
try
{
using (var ctx = new GeneralClasses.AlraedContext())
{
//page *= 10;
var lst = ctx.Items.Where(c => c.Name.Contains(term)).ToList();
return Ok(JsonConvert.SerializeObject(lst));
}
//var lst = Item.GetAll();
}
catch (Exception)
{
return InternalServerError();
}
}
and the select2 ajax