0

I tried jQuery get function and coded the below. What is wrong with my below code? Its not working.

<style type="text/css">
<!--
#Layer1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
}
-->
</style>
<div id="Layer1"> </div>
<script type="text/javascript">
    jQuery.get('http://google.com/', null, function(data)
    {$('#Layer1').append(data);
}, 'html');
</script>
2
  • If you are really using google.com then its a cross domain request, which should not work. Commented Oct 8, 2011 at 19:49
  • I tried even ` jQuery.get('test.html', null, function(data)` but no use :( Commented Oct 8, 2011 at 19:55

1 Answer 1

2

You are trying to get data from a different origin which isn't allowed for security reasons.

Sign up to request clarification or add additional context in comments.

3 Comments

I tried even ` jQuery.get('test.html', null, function(data)` but no use :(
If you want to get data from a different origin the only option is JSONP (en.wikipedia.org/wiki/JSONP).
try $.get('test.html', function(data)...); no null as second paramter

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.