开发者

Load function in jquery

I am relatively new to jquery and would like to know why the below code wouldn't work. I am trying to access the content from a file residing on my site and not outside. Is it because I have the jquery lib loading from google and not my site? The error message that I get in IE browser is "Access Denied". I am confused why the access is denied if I am trying to load a file from the same server and even same folder.

<html> 
<head>
<script type="text/javascript" language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" language="JavaScript">
$(document).ready(function(){

 $("#response").load("http://www.mydomain.com/loadme.php?route=links/getlinks&path=2");
});
</script>
</hea开发者_运维知识库d>
<body>
<div id="response" style="border: 1px solid #000;height:500px;">&nbsp;</div>
</body>
</html>

any one please help me.

thanks


What happens if you try

$.get('/loadme.php?route=links/getlinks&path=2', function(data) {
  $('#response').html(data);
});

at the very least you can

alert(data)

and see if that helps you debug.


jQuery Code

$("#aboutme").click(function(){
    $("#response").load("/loadme.php?route=aboutme&path=2");
});

Html code changed href ="javascript:void(0)" to "#" . The problem in using this "#" is it will go to the top of the page each time when I click on a link. I removed href=# and it works fine but not sure if its ok not to have the href

<li>
    <a id="aboutme" href="javascript:void(0)">
        <span class="showcase-text">About Me</span>
    </a>
</li>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜