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

135
Views
How let an ajax request to read a number that is a result of an sql query

I have a very simple sql query:

      case 'getFeedbackIvr':
      $idClient = $_GET['idClient'];
      $query = "SELECT COUNT(idClient) AS _callsNumber
      FROM table
      WHERE idClient = {$idClient}";
      $callsNumber='_callsNumber'

First, I'm trying to understand if this:

$callsNumber='_callsNumber'

is correct

What I need is that when a field in a php form is filled, query is executed and an Ajax request reads the value in $callsNumber and if this value>0 a field (field) in a php form has to appear, else hidden if $callsNumber=0

After several attempts and searchs I'm doing this (but it's incomplete and that's why I'm making this ask):

<script>
$(document).ready(function(){

$.ajax({
            type: 'GET',
            dataType: "html",
            url: '<?=$requestUrl?>' + "?ivrChoiceId="+$(this).val()+"&qType=getFeedbackIvr",
            success: function(data){ 
                $("?").html(data);          
            },
            async:true
$('#field').closest('tr').hide();




    
    if ($callsNumber>0)
         {
            $('#field').closest('tr').show();
            
            
                        
        }else{
            
            $('#field').closest('tr').hide();
        });
       });
       });

</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!