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

255
Vistas
Processing angular http post response data with xml dom parser

I need to process some angular http post response data which is a web page to replace a div tag of the current web page with a selected div tag from the response page. Here is my code:

<div id="content"></div>
<script>
    var app = angular.module("app", []);

    app.controller("cntr", function($scope, $http) {
                                        
            $scope.myfunction = function(){
                var url = '/webApp';
                var data = {'data':$scope.mydata};
                var config = {headers:{'Content-Type':'application/json'}};
                $http.post(url,data,config)
                        .then(function(response){
                           $("#content").html(response.data.getElementById('content'));
                           console.log(response.data);
                        },
                              function(response){
                                console.log(response.data);
                          });
                }
        }); 
    </script>

From the console log, i get getElementById is not a function But using

$("#maincontent").html(response.data);
console.log(response.data);

I get the page displayed showing that it is a web page received but this time, the div element is filled with the whole web page. My question is how do I get to process or parse the response data web page with a better alternative to the getElementById function?

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