How to check local server or internet server is online/offline using only js/jquery? no angular or nodejs

jquery
php

#1

Hello Everyone
i am working to buld an html template and add php contact form. i code to check whether my local server or (when i upload to internet hosting server ) internet server is online or offline to run my php file.
if server is offline i want to show an error message page and i wants to find this using core javascript or jquery no angular nodejs or anyother framework.
Thanks for reading and help me.


#2

Why? Do you expect it to be offline a lot?


#3

actually i wants when someone or me open this html template and when someone try to send a contact form information i show him a page. i just validate it in simple words. and i need this. Do you have any idea?


#4

But if the server is offline, how can people see the contact page at all?


#5

No, you can't understand. the contact form is show whenever server is on/off i wants if someone submit form if server is offline then show an error message page as php won't run until server is on. This is what i want.


#6

Scallio's question is more along the lines of 'why is your form handler on a different server'.

As for figuring out if the other server is online, fire an AJAX request off to the root of the other server. If the response code comes back 200, the server's online and listening correctly.


#7

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.