Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular JS : Uncaught DOMException: Failed to execute 'removeChild' on 'Node' on HTMLScriptElement.callback

I am using Angular JSON Http call. in the same When I make the post request like this :

app.service('AjaxService', [ '$http','$q','$sce', function($http,$q,$sce) {
    return {
        getSearchResultsJSONP : function() {
            var url="http://stage-sp1004e4db.guided.lon5.atomz.com/?searchType=globalsearch&q=this&sp_staged=1&callback=JSON_CALLBACK";
            $sce.trustAsResourceUrl(url);
            $http.jsonp(url)
                .success(function(data) {
                console.log("Data for default SNP call" ,data);
            }).
            error(function (data) {
                console.log("request Failed ! ");
            });
        },
        getSearchResult : function(searchText,url){
            var defer = $q.defer();
            $http({
                url: url, 
                method: "GET",
                params: {searchresInput: searchText}
            }).then(function(data, status, header, config){
                defer.resolve(data);

            }).then(function(data, status, header, config){
                defer.reject(data);

            });
            return defer.promise;
        }
    };

}]);  

I can see the data in the network and response comes as 200 OK status.

But I am getting an error during complete code run :

Uncaught TypeError: Cannot read property 'parentElement' of undefined
    at checklistFunc (masterlowerlibs.67785a6….js:42972)
checklistFunc @ masterlowerlibs.67785a6….js:42972

can someone help me in the same, how to resolve this or what went wrong in the same ?

My response looks like :

angular.callbacks._0({metadata: {,…}, pagination: {totalpages: "1", firstpage: "", pagelinks: {pagelink: [,…]}},…})
facets
:
[{}, {}, {}, {}, {}, {}, {}, {}]
metadata
:
{,…}
pagination
:
{totalpages: "1", firstpage: "", pagelinks: {pagelink: [,…]}}
results
:
[,…]
sort
:
[{selected: true, name: "default", value: "relevance"}, {name: "Latest", value: "tkh_pageDate"}]
like image 780
vaibhav Avatar asked Jan 30 '17 07:01

vaibhav


1 Answers

If you click on the error code line I assume you get the minified/obfuscated code, therefore I would suggest you to install and debug with AngularJS Batarang plugin for Chrome browser.

I hope this will help to understand why the error occurres.

like image 65
hakany Avatar answered Oct 23 '22 20:10

hakany