is $.get can get from outside site

Discussion in 'JavaScript' started by moheballah, Nov 13, 2011.

  1. #1
    hi,

    what is the wrong with that code


    $.get($link, function(data)
    {
    	alert(data.toSource());
    });
    HTML:
    if link inside site i get content
    but if link other like google.com i do not get any thing
    why?
     
    moheballah, Nov 13, 2011 IP
  2. md87

    md87 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    As far as I am concerned, it won't work, because JavaScrip cannot access web pages hosted on another domain.
     
    md87, Nov 16, 2011 IP
  3. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #3
    it will work but not always in some websites, maybe because this sites has already blocked your script from doing so.
     
    JohnnySchultz, Nov 18, 2011 IP