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

81
Views
How to post previous Jquery ajax search checkbox with PHP?

I am working on ajax with jquery,Right now I am using jquery "autocomplete" function So after I enter some characters I am getting list of records with checkbox but problem is that "I can't post previous checked checkbox records",Means if I search something and select some check boxes and then do another search and select some checkbox then the previous checked checkbox value is not posting,How can I do this ? I tried with following code but not working correctly (only posting current select/checked records),Where I am wrong ? Thank you in advance

<input type="text" id="autouser" name="coin" class="form-control">
            <div id="resultDiv"></div>
        

<script type='text/javascript'>
    $(document).ready(function(){
    $( "#autouser" ).autocomplete({
         source: function( request, response ) {
          // Fetch data
          $.ajax({
            url:'<?php echo base_url();?>main/CoinReords',
            type: 'post',
            dataType: "json",
            data: {
              search: request.term
            },
            success: function( data ) {
                $("#resultDiv").html("");
                $.each(data, function(i, record) {
                    console.log(record.label);
                $("#resultDiv").append("<input type='checkbox' value='" + record.label + "' id='chk-" + i + "' name='CoinName[]' /> " + record.label);
  });
            }
          });
        },
        select: function (event, ui) {
            $('#autouser').val(ui.item.label); // display the selected text
          $('#resultDiv').selectedItems.push(ui.item.label); 
          return false;
        }
      });

    });
    </script>
about 4 years ago · Juan Pablo Isaza
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!