示例代码:
var connection = null;
function onConnect(status) {
im_a_big_error.log('wtf');
// Why it doesn't throw me an error here ??
}
$().ready(function() {
connection = new Strophe.Connection('http://localhost:8080/http-bind');
connection.connect('admin@localhost', 'admin', onConnect);
});
在我的Chrome控制台中没有报错。
你有解决这个问题的想法吗?
onConnect
被调用了吗?它应该会抛出undefined is not a function
或类似的错误。 - alexconnection.connect('admin@localhost', 'admin', onConnect);
。 - Unitech$().ready(..)
在一个空的 jQuery 集合上注册了ready
事件。你应该使用$(document).ready(..)
或它的简写形式$(..);
-..
是你的回调函数。 - ThiefMaster$(document).ready(..)
都不会抛出错误 :( - Unitech