I want to check server connectivity in odoo pos using javascript. how I do that ?
Thank you
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
3413
Views
We can use below method:
function doesConnectionExist() {
var xhr = new XMLHttpRequest();
var file = "https://www.kirupa.com/blank.png";
var randomNum = Math.round(Math.random() * 10000);
xhr.open('HEAD', file + "?rand=" + randomNum, true);
xhr.send();
xhr.addEventListener("readystatechange", processRequest, false);
function processRequest(e) {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 304) {
alert("connection exists!");
} else {
alert("connection doesn't exist!");
}
}
}
}
function doesConnectionExist() {
var xhr = new XMLHttpRequest();
var file = "https://www.kirupa.com/blank.png";
var randomNum = Math.round(Math.random() * 10000);
xhr.open('HEAD', file + "?rand=" + randomNum, true);
xhr.send();
xhr.addEventListener("readystatechange", processRequest, false);
function processRequest(e) {
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 304) {
alert("connection exists!");
} else {
alert("connection doesn't exist!");
}
}
}
}