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

140
Views
HTML final con formulario de respuesta ajax php

Estoy tratando de enviar información a un archivo php desde un formulario html. El formulario funciona bien y php procesa la información correctamente, pero tengo problemas con la respuesta de la devolución de llamada.

Aquí está el código javascript:

 function jvsSubmit(fd){ var submitUrl = 'repeater_field_capture.php'; $.ajax({ type:'post', url: submitUrl, data: fd, contentType: false, processData: false, success: function(response){ submit_settings_form_callback(response); }, }); } function submit_settings_form_callback(data){ console.log(data); }

Aquí está el código php:

 if(isset($_POST['formInfo'])) { update_option('text',$_POST['text']); $return = ['success' => 1, 'message' => 'Message Sent']; echo json_encode($return);

}

Todo funciona bien excepto por la respuesta de la devolución de llamada. Esto es lo que veo cuando registro en la consola los datos de la devolución de llamada.

 {"success":1,"message":"Message Sent"}<!doctype html> <html lang="en-US" > <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Page not found &#8211; DB Website Projects</title> <meta name='robots' content='max-image-preview:large' /> <link rel='dns-prefetch' href='//sworg' /> <link rel="alternate" type="application/rss+xml" title="DB Website Projects &raquo; Feed" href="https://projects.db-websites.com/feed/" /> <link rel="alternate" type="application/rss+xml" title="DB Website Projects &raquo; Comments Feed" href="https://projects.db-websites.com/comments/feed/" /> <script> window._wpemojiSettings =........

Como puede ver, el objeto json está allí, pero hay algunos html finales que están causando un problema.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede detener la ejecución del resto de su secuencia de comandos PHP agregando die() o exit() después de echo json_encode($return); línea.

about 4 years ago · Juan Pablo Isaza 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!