2

i have a database of website addresses, and need some kind of "loop" to check this websites online status using jQuery AJAX.

before

URLs                        | status
----------------------------|--------
http://www.google.com       |
http://www.yahoo.com        |
http://www.lycos.com        |
http://www.blablabla.com    |

[btn_CheckOnlineStatus]

after i push [btn_CheckOnlineStatus]

URLs                        | status
----------------------------|--------
http://www.google.com       | online
http://www.yahoo.com        | offline
http://www.lycos.com        | online
http://www.blablabla.com    | online

[btn_CheckOnlineStatus]
armen
  • 1,253
  • 3
  • 23
  • 41
  • what exactly do you mean by online status? – Bhadra Jul 05 '13 at 07:40
  • Do you have a particular problem with that? Please post your code and explain what the issues you have with it. – Felix Kling Jul 05 '13 at 07:42
  • @armen That's nice. What would you like me to do about this? –  Jul 05 '13 at 07:42
  • Doing it with ajax you will have a Same Origin Policy problem. You'll have to proxy each request through some server side script on the same domain. – MrCode Jul 05 '13 at 07:43
  • with online status i mean if you write the given address, the response will be 500 (i think), and not 404 ( `Page Cannot Be Found` ), or no `Server not found`. in other words site is up and running. – armen Jul 05 '13 at 07:45
  • @armen Is this question is kind about HTTP request? – Olrac Jul 05 '13 at 07:45
  • jQuery is something very new to me, and i think the task is simple. all i need is a client side script that can check if given address has a normal response or not, that is if i type www.google.com in my browser, i'll see google website in front of me, and if i type xyz.qwerqwer.jkl my browser will complain about `server not found`! i need this "check" be done by a script with a status message. – armen Jul 05 '13 at 07:50
  • That has 0 to do with jQuery and all to do with how the browser will allow javascript access to foreign sites. Try the script in the link to the other question. If it works for you, you are done. Alternatively have a server process do the work and reprot to javaScript – mplungjan Jul 05 '13 at 08:43

1 Answers1

3

You need to ping that sites, I only know to ping site through java.

This question is related to you:

Is it possible to ping a server from Javascript?

Community
  • 1
  • 1
commit
  • 4,777
  • 15
  • 43
  • 70
  • 1
    this is a good post, and partially covers my question, but even the accepted answer does not function correctly. – armen Jul 05 '13 at 09:26