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

109
Vistas
XML does not render after making an ajax call

I am trying to make an ajax call and on the server accessing a field from the table I have the following:

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

I want this result to be displayed with its respective format and labels and I cannot get it.

In the controller I have the following:

class RequestResponseController extends Controller
{
    public function show_data(Request $request){

        $rr = RequestResponse::find( $request->id);

        $text = $rr->response;

        return $text;

    }
}

And from view I call it with 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;
}

But in the modal it shows me only text without xml tags, that is:

Successb3633c9eeb13498f9098

But I need to get:

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

I hope it helps me thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're using jQuery's html() method which tells it to parse the input as HTML.

In HTML <this> is a tag and isn't rendered as plain text.

Use the text() method if you want to tell jQuery to render the input as text instead of HTML source code.

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