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

253
Views
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
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!