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"}]
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With