Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:59:30+00:00 2026-06-15T02:59:30+00:00

So i have a select2 ajax selector that works perfectly when not using multiple

  • 0

So i have a select2 ajax selector that works perfectly when not using multiple , but when I use multiple it basically sometimes it works , others it doesn’t.

    $('#organizations').select2(
    {
        placeholder: "Add Organizations!",
        minimumInputLength: 3,
        multiple: true,
        ajax: {
            url: "https://boilerprojects.com/organizations/search",
            dataType: 'json',
            quietMillis: 100,
            data: function (term, page) {
                return {
                q: term, // search term
                page_limit: 10
                };
            },
            results: function (data, page)
            {
                var more = (page * 10) < data.total;
                console.log(data.results);
                return { results: data.results, more: more };
            },
            dropdownCssClass: "bigdrop"
        },
    });

what returns from my PHP is : {"results":[{"id":"6","text":"LukePOLO"}]}

So im getting results its just not populating.

Anyone have any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:59:32+00:00Added an answer on June 15, 2026 at 2:59 am

    If you want to use that infinite scroll option, then your response is wrong.

    {"results":[{"id":"6","text":"LukePOLO"}]}
    

    should be something like:

    {"results":[{"id":"6","text":"LukePOLO"}], "total":"1"} //Total 1 result
    

    you have key results but do not have a key for total. And in your post data function you should allso say witch page you search.

    $('#organizations').select2(
    {
        placeholder: "Add Organizations!",
        minimumInputLength: 3,
        multiple: true,
        ajax: {
            url: "https://boilerprojects.com/organizations/search",
            dataType: 'json',
            quietMillis: 100,
            data: function (term, page) {
                return {
                q: term, 
                page_limit: 10,
                page: page //you need to send page number or your script do not know witch results to skip
                };
            },
            results: function (data, page)
            {
                var more = (page * 10) < data.total;
                return { results: data.results, more: more };
            },
            dropdownCssClass: "bigdrop"
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Javascript code that works perfectly: $(document).ready(function() { $(#Select1).setDefault(); $(#Select2).setDefault(); $(#Select3).setDefault();
I have a series of two chained selects using ajax that work great. I
I have a form submit with an AJAX post. It works fine. But when
I know that .append() does not have any callback function, but when I try
I have several selects that I populate using JQuery Ajax. Most load fine. There
I currently have a ajax script that dynamically builds two select boxes enabled with
I have an emote selector that opens up when a user clicks an entry
I have select inputs dynamically added to form by $(selector).append(html) I'm using live('change',handler) to
I have a form that I am trying to post to php using jQuery
I have an img that when clicked, points to a form using a custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.