This is what needs to be updated to version 4
Thanks
ajax: {
url: "@Url.Content("~/getMyList")",
dataType: "json",
type: "GET",
data: function (params) {
var queryParameters = {
term: params//.term
}
return queryParameters;
},
results: function (data) {
var myResults = [];
$.each(data.results, function (index, item) {
myResults.push({
'id': item.text.replace(",", "|"),
'text': item.text
});
});
return {
results: myResults
};
}
Your biggest issue here is not going to be with the AJAX configuration, but with setting the initial selection. The only thing that you need to change (as far as I can tell) with your AJAX config is that ajax.results is now ajax.processResults.
--
You received this message because you are subscribed to the Google Groups "select2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
To post to this group, send email to sel...@googlegroups.com.
Visit this group at https://groups.google.com/group/select2.
For more options, visit https://groups.google.com/d/optout.
Hi Kevin,
Thanks for responding.
The problem I’m running into currently is with the ajax call.
When I try to initialize I get an error – Option multiple is not allowed for Select2 when attached to a select element.
Removing multiple = true and moving it inline with multiple=”multiple” cleared this one up
Next was the ajax one – Option ajax is not allowed for Select2 when attached to a select element.
The documentation states that the hidden element scenario is not needed anymore, but I’m not sure that’s completely true.
Our main reason for doing this update is an attempt to get theses controls to function in IOS systems.
Thanks
--
You received this message because you are subscribed to a topic in the Google Groups "select2" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/select2/UZQs-DSSys4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to select2+u...@googlegroups.com.
If you're getting either of those errors, it's a sign that you are not actually usually Select2 4.x. I would check to make sure you are actually loading in the right version, and that nobody else is loading in a different version after you (if you're in a shared plugin environment, like WordPress).
If you look at the examples page in the documentation, you'll see at least one example of us using AJAX with a select element.