Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

254
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda