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

251
Views
Variable from JS to PHP using AJAX - *Undefined array key "profile_viewer_uid" in C:\xampp\htdocs\zkoska\ppp.php on line 2*

I wanted to POST variable from JS file to PHP using AJAX. I have both these files in same folder but when I run php code, I don´t see: Warning: Undefined array key "profile_viewer_uid" in C:\xampp\htdocs\zkoska\ppp.php on line 2

Why would be profile_viewer_uid undefined if I have it in JS and code also contains connection: url: "PPP.php", What is wrong here?
Thank you

javas.js

<script>
var profile_viewer_uid = 1;
$.ajax({
  url: "PPP.php",
  method: "POST",
  data: { "profile_viewer_uid": profile_viewer_uid }
}) 
</script>

ppp.php

<?php
 $profile_viewer_uid = $_POST['profile_viewer_uid'];
 echo($profile_viewer_uid);
 // prints 1
 ?>
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!