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

113
Views
XML no se procesa después de hacer una llamada ajax

Estoy tratando de hacer una llamada ajax y en el servidor accediendo a un campo de la tabla tengo lo siguiente:

 <PushProperty><Status ID = "1"> Success </Status><ResponseID> b3633c9eeb13498f </ResponseID><ID> 9098 </ID></PushProperty>

Quiero que se muestre este resultado con su respectivo formato y etiquetas y no lo consigo.

En el controlador tengo lo siguiente:

 class RequestResponseController extends Controller { public function show_data(Request $request){ $rr = RequestResponse::find( $request->id); $text = $rr->response; return $text; } }

Y desde la vista lo llamo con ajax:

 function show_request_response (id, type) { $.ajax ({ url: "/request_responses/show_data", data: { "_token": "{{csrf_token ()}}", "id" : id, "type": type, }, method: "POST", async: false, success: function (xmlResponse) { $ ('# exampleModal'). modal ('show'); $ ('# exampleModal .modal-title'). html ("Response XML"); $ ('# exampleModal .modal-body'). html (xmlResponse); } }); return false; }

Pero en el modal me muestra solo texto sin etiquetas xml, es decir:

Éxitob3633c9eeb13498f9098

Pero necesito conseguir:

 <PushProperty> <Status ID="1">Success</Status> <ResponseID>b3633c9eeb13498f</ResponseID> <ID>9098</ID> </PushProperty>

espero que me ayude gracias.

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

0

Está utilizando el método html() de jQuery que le indica que analice la entrada como HTML.

En HTML, <this> es una etiqueta y no se representa como texto sin formato.

Use el método text() si desea decirle a jQuery que represente la entrada como texto en lugar de código fuente HTML.

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!