admin管理员组文章数量:1332377
I am not able to figure out what is wrong with my code.I am getting data from post as an array and I am then displaying that data in box.
function worker() {
var a = $("#BeeperBox");
var delay =2000;
$.ajax({
url: '/index.php/admin/getLatest',
success: function(data) {
$.each(data.upda,function(i, v){
var out = v.name + v.mob ;
$('span.blueName').html(out);
$("#BeeperBox").show();
timerId = setTimeout(function () {
a.hide();
}, delay);
});
},
plete: function() {
// Schedule the next request when the current one's plete
setTimeout(worker, 50000);
}
});
}
When i run it firebug shows error: TypeError: e is undefined.
I am not able to figure out what is wrong with my code.I am getting data from post as an array and I am then displaying that data in box.
function worker() {
var a = $("#BeeperBox");
var delay =2000;
$.ajax({
url: '/index.php/admin/getLatest',
success: function(data) {
$.each(data.upda,function(i, v){
var out = v.name + v.mob ;
$('span.blueName').html(out);
$("#BeeperBox").show();
timerId = setTimeout(function () {
a.hide();
}, delay);
});
},
plete: function() {
// Schedule the next request when the current one's plete
setTimeout(worker, 50000);
}
});
}
When i run it firebug shows error: TypeError: e is undefined.
Share Improve this question edited Apr 15, 2014 at 16:57 user2102869 asked Apr 15, 2013 at 5:19 RiderHoodRiderHood 791 gold badge1 silver badge7 bronze badges 12- Have you followed the stack trace of the error ? – AllTooSir Commented Apr 15, 2013 at 5:20
-
2
The quoting in the initialisation of
var a
is broken. Is it that way in the original code? – michaelb958--GoFundMonica Commented Apr 15, 2013 at 5:21 - No it was not broken in my original code. – RiderHood Commented Apr 15, 2013 at 5:24
-
i think there is some other code that is breaking your script... post other function where youare using the
e
– bipen Commented Apr 15, 2013 at 5:24 -
2
@user2257655 It doesn't matter if you encode it as JSON...jQuery doesn't know what you're sending back. Just set the
dataType
option as "json". Like$.ajax({ url: '/index.php/admin/getLatest', dataType: "json", success: func... });
– Ian Commented Apr 15, 2013 at 5:35
2 Answers
Reset to default 4since your sending the response as JSON.. its better to specify your dataType
as JSON (though If none is specified, jQuery will try to infer it based on the MIME type of the response
) so that you don't have to parse it manaully..i think the problem here is you havn't parsed the json that you got as response
try this
$.ajax({
url: '/index.php/admin/getLatest',
dataType: 'json',
success: function(data) {
$.each(data.upda,function(i, v){
var out = v.name + v.mob ;
......
},
Check if data.upda is undefined, I think the problem is that that variable doesn't exist and you're trying to iterate over a undefined element.
本文标签: javascriptGetting typeErrore is undefined in firebug while running a scriptStack Overflow
版权声明:本文标题:javascript - Getting typeError:e is undefined in firebug while running a script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742305902a2449908.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论