3 Replies - 6718 Views - Last Post: 16 March 2012 - 06:03 AM

#1 aklo  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 229
  • Joined: 23-January 09

Simple jquery load() not working

Posted 16 March 2012 - 05:54 AM

Edit: not working on chrome and I didn't expect it.

I'm trying to do a real simple load() before I get deeper in .ajax() but this is frustrating...
http://api.jquery.com/load/
The above url will have examples almost exactly as what I have below but it is not working for me.

<!DOCTYPE html>
<html>
   <header>
      <link rel=stylesheet href="style.css" type="text/css" />
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" ></script>
      <script type="text/javascript">
         $(document).ready(function(){
            $('.content').load("a.html",function(){
               alert("Test");
            });
         });
      </script>
   </header>
<body>
 <div class="content"></div>
</body>
</html>



Css nothing much
*{
	margin:0;
	padding:0;
}

body{
	background-color:#676767;
}

.content{
	height:500px;
	width:500px;
	background:grey;
}


This post has been edited by aklo: 16 March 2012 - 06:03 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Simple jquery load() not working

#2 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3393
  • View blog
  • Posts: 9,591
  • Joined: 08-June 10

Re: Simple jquery load() not working

Posted 16 March 2012 - 05:58 AM

maybe it's because you use a class instead of an ID?
Was This Post Helpful? 0
  • +
  • -

#3 revolutionx  Icon User is offline

  • D.I.C Head

Reputation: 60
  • View blog
  • Posts: 229
  • Joined: 23-July 09

Re: Simple jquery load() not working

Posted 16 March 2012 - 06:02 AM

Your code works fine for me. I get the alert message, and then it loads the external .html file in the div.
Was This Post Helpful? 0
  • +
  • -

#4 aklo  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 229
  • Joined: 23-January 09

Re: Simple jquery load() not working

Posted 16 March 2012 - 06:03 AM

Still the same after changing to ID.

I need to add that the code is not working in google chrome.

I didn't expect it to not work on chrome...

Just tested on firefox and IE and it works...

So partly the problem is solve (maybe chrome bug) but if any of you have a solution to make it work on chrome that is also appreciated :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1