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

148
Views
¿Por qué la respuesta de ajax devuelve el código php completo y no una variable de eco?

Tengo un código de ejemplo como este:

JQ:

 $.ajax({ type: 'GET', url: 'getData.php', success: function(data) { console.log(123); console.log(data); console.log(123); } });

PHP:

 <?php $text = "hello"; echo $text; ?>

Y obtengo todo el código como este

ingrese la descripción de la imagen aquí

¿Por qué no se muestra 「hola」?

Corro en Mamp, ¿no es trabajo?

¡Gracias!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

tienes que usar esto en PHP:

 <?php $text = "hello"; echo json_encode($text); ?>

y tienes que pasar

 header('Content-Type: application/json');

Tal vez sea útil

over 4 years ago · Santiago Trujillo Report
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!