javascript - Angular Js beginner Ajax Call -
i'm new angular js, inside controller.js controllers app, 100% working. i'm having problem how make ajax call using angular js. i'm trying fetch data service , pass index.html using ajax. when try debug code, hits on $http
doesn't go through code inside it. doing wrong here?
$http({ method: 'post', url: 'http://someservice.site.net/site.aspx', data:{action:'someaction', position:'founders'}, headers: {'content-type': 'application/x-www-form-urlencoded'} }).then(function successcallback(response){ var json =jquery.parsejson(response); var htmldata=""; for(i=0; i<json.length; i++) { var htmlinfo = '<li><div class=\'col\'><a href="'+ json[i].id +'"><img width=\'100%\' height=\'auto\' src="'+json[i].image + '" class=\'profile-img\' /><h3>' +json[i].name+'</h3><p>'+json[i].title+'</p></a></div></li>'; htmldata+= htmlinfo; } jquery("#vflist").html(htmldata); }, function errorcallback(response){ });
mark breakpoints on success , error callbacks.
$http service. passed required data in it's parameter.
$http({}) ^options
after calling $http it's work , send request provided url asynchronously. don't need debug part.
$http({options}) .then(function(data){ // mark 1 breakpoint here }, function(data){ // mark breakpoint here })
Comments
Post a Comment