有没有办法检查服务器的可达性测试.如果应用程序无法连接服务器,那么它会显示警报吗?是否有任何方法来检查..我检查互联网连接.如果没有连接,那么我正在显示警报.但如果有连接,但没有服务器的可达性,我怎么能处理这个.我正在检查这种连接状态.. !!
setInterval(function () {
connectionStatus = navigator.onLine ? 'online' : 'offline';
if(connectionStatus=="offline"){
// alert("There is no connection");
}
}, 100);
$.ajax({url: "192.168.12.171",
dataType: "jsonp",
statusCode: {
200: function (response) {
alert('status 200');
},
404: function (response) {
alert('status 404 ');
}
}
});
Run Code Online (Sandbox Code Playgroud) 我需要一些线程化java脚本的概念.实际上我遇到了一个问题.问题是我有一个函数A()调用函数B和C.
function A(){
B();
C();
}
function B(){
//doing some task
i=something;
alert(i);
}
function C(){
// i need value I here.
alert(i) //getting undefined
}
Run Code Online (Sandbox Code Playgroud)
我需要同步通话...