views:

38

answers:

2
$(document).ready(function()
{



var response = $.ajax({ type: "GET",   
                          url : "http://www.google.com",   
                        async : false,
                      success : function(resp) {
                                    alert(resp);
                                }
               });



});

no output....

A: 

I am not sure what you are trying to achieve but can try something like

$('#result').load('ajax/test.html', function() {
  alert('Load was performed.');
});

or have a look here http://api.jquery.com/load/

<!DOCTYPE html>
<html>
<head>
  <style>
 body{ font-size: 12px; font-family: Arial; }
 </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
</head>
<body>

<b>Footer navigation:</b>
<ol id="new-nav"></ol>

<script>
  $("#new-nav").load("/ #jq-footerNavigation li");
</script>
</body>
</html>

Update

If you know PHP you can try .. http://www.wait-till-i.com/2010/01/10/loading-external-content-with-ajax-using-jquery-and-yql/

Wbdvlpr
while giving local URL (eg: abc.html) it is working fine, But URL(http://abc.com) no output
Srinivas Tamada
Ok got it.. perhaps @jAndy's answer help you.
Wbdvlpr
+4  A: 

You are trying to break the "ajax same origin policy".

That means, you cannot access a foreign domain with an Ajax request. "Workarounds" are to use JSONP, HTML5 or CORS. All of those must be supported serverside.

The most common thing to solve this issue is, to use your webserver as a proxy. Let your server make the request and send the results back to your website.

jAndy
Thank you!. You have any idea about facebook displaying URL title and Meta description
Srinivas Tamada