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

180
Vistas
Replace string in js in another html page

I am trying to print on an html page the response from a REST request with JS, but when I return the string on the html page is not replaced.

JS code

                function sendDELrequest() {
                serviceID = $("#serviceID").val();
                var myurl = "/api/microservice/"+serviceID; 
                $.ajax({
                    method: "DELETE",
                    url: myurl,
                    success: function (response) {
                        Resp(response);
                    },
                });
            }

            function Resp(r) {
                resp=open("response.html").read();
                resp = resp.replace(/__RESPONSE_VALUE__/g, r.text);
                document.location.href = '/response';
                }

HTML

<head>
    <meta charset="utf-8" />
    <title>Patient Monitoring - Response</title>
    <link rel="shortcut icon" type="image/png" href="/img/healthcare.png">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/style.css" />
</head>


<body>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <div class="container">
        <p>&nbsp;</p>
        <h3 style="text-align: center;">__RESPONSE_VALUE__</h3>
        <p>&nbsp;</p>
        <p style="text-align: center;">
        <input type="button" class="button" onclick="document.location.href='/';" value="Homepage"><br></p>
    </div>
</body>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can set only html value when getting success after ajax . Select using ID where you want to show the results

$("#id").html()
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