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

144
Views
javascript variable pass into php

I get category id by js and want to use it to get category description. when i am passing this id using ajax into php variable its print correct output but when i try to put this id in get_description code ajax give 500 error and not return output why this happen please help me.

Below is my code.

<script type="text/javascript">
 $(".-filter").click(function() {
        var js_var = this.id;

               $.ajax ({
                    type: "POST",
                    url: "<?php echo plugin_dir_url( __FILE__ ); ?>category.php",
                    data: { val : js_var },
                    success: function( result    ) {               
                   $("#update").html(result);
            }

        });
    });
</script>

<div id="update">
<?php 
$cat_id = $_POST['val'];
echo $cat_id;
//echo term_description($cat_id,'category');
?>`enter code here
</div>

Thanks,

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