Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda