angularjs jsonp回调错误 [英] angularjs jsonp callback error

查看:108
本文介绍了angularjs jsonp回调错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面给我的代码示例它返回(未捕获的ReferenceError:updateData未定义)错误。你能帮我找到我所缺少的东西,请帮助我让它变得可行。 在这里您可以找到代码,我的服务返回JSONP响应。





var student = angular.module(studentModule,[]);



student.controller(StudentCtrl,[$ scope,$ http,函数($ scope,$ http){

$ http({

方法:'jsonp',

url:'http://abelski.com/courses/ajax/data.json?callback=updateData'



})

.success(函数(数据,状态,标题,配置){

$ scope.students = data;



})



.error(函数(数据,状态,标题,配置){



});

}]);

解决方案

scope,

< br>

http,函数(


scope,


guy below i given my code sample it's returning (Uncaught ReferenceError: updateData is not defined) error . could you help me to find what i am missing , pls help me to make it workable . here you can find code , my service returning JSONP response .


var student = angular.module("studentModule", []);

student.controller("StudentCtrl", ["$scope", "$http", function($scope, $http) {
$http({
method: 'jsonp',
url: 'http://abelski.com/courses/ajax/data.json?callback=updateData'

})
.success(function (data, status, headers, config) {
$scope.students = data;

})

.error(function (data, status, headers, config) {

});
}]);

解决方案

scope", "


http", function(


scope,


这篇关于angularjs jsonp回调错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆