Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

259
Views
Bootstrap Select send additional parameter to ajax

Does anyone know how to get the value of a data attribute "date" from a bootstrap-select? I want to send additional parameter as a filter because in one page i have several selectpicker for each date

<select class="selectpicker" data-date="2022-04-21"></select>
<select class="selectpicker" data-date="2022-04-22"></select>
<select class="selectpicker" data-date="2022-04-23"></select>

my current script is like this

$(".selectpicker").selectpicker().ajaxSelectPicker(
        {
            ajax: {
                url: "ajax/search_by_date.php",
                type: "POST",
                dataType: "json",
                data: {
                    q: "{{{q}}}",
                    date: $(this).data("date"),
                }
            },
            locale: {
                emptyTitle: "Please type room name"
            },
            preprocessData: function(data) {
                var i,
                l = data.length,
                array = [];
                if (l) {
                    for (i = 0; i < l; i++) {
                        array.push(
                            $.extend(true, data[i], {
                                text: data[i].name,
                                value: data[i].id,
                            })
                        );
                    }
                }
                return array;
            },
            preserveSelected: false
        });
    $("select").trigger("change");

with this i get null on $_POST["date"]

thank you for your help

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!