GET http://localhost:50970/Commitment/Customers?q=i 500 (Internal Server Error)
send @ jquery-2.1.4.js:8630
jQuery.extend.ajax @ jquery-2.1.4.js:8166
b.transport @ select2.min.js:2
d @ select2.min.js:2
This is client side:
var customerCache = [];
$(".select2-me").select2({
ajax: {
url: '@Url.Action("Customers", "Commitment")',
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term // search term
};
},
processResults: function (data) {
customerCache = [];
$.each(data, function (idx, value) {
customerCache[value.Code] = value;
});
return {
results: data
};
},
cache: true
},
});
});
and if need server side:
public JsonResult Customers(string q)
{
var customers = CustomerDM.GetList(q);
return Json(customers, JsonRequestBehavior.AllowGet);
}
Someone can help me?