Jquery ajax加载问题

时间:2010-09-22 10:20:48

标签: jquery html ajax load

为什么这不起作用?

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

Jquery版本使用:1.3.1分钟

html代码:

<body>
<div id="top">
 <div class="wrapper">
  <a href="http://www.bmvisuals.nl/" id="logoh1">BMvisuals</h1></a>
  <div id="menu">
   <a href="index.html">
    <span id="mhome">Home</span>
    Beginpagina
   </a>
   <a href="overons.html">
    <span id="moverons">Over ons</span>
    Wie zijn wij
   </a>
   <a href="diensten.html">
    <span id="mdiensten">Diensten</span>
    Wat doen wij
   </a>
   <a href="werkwijze.html">
    <span id="mwerkwijze">Werkwijze</span>
    Hoe wij het doen
   </a>
   <a href="portfolio.html">
    <span id="mport">Portfolio</span>
    Wat we gedaan hebben
   </a>
   <a href="contact.html">
    <span id="mcontact">Contact</span>
    Neem contact op
   </a>
  </div>
 </div>
</div>
<div id="floor">
 <div id="floorbg">
   <div id="catch">
    We doen het allemaal
    <h2>Website design, logo design, webshop, CMS, SEO, huisstijl...</h2>
   </div>
   <div id="content">
    <div class="top"></div>
    <div class="bg">
     <div id="contentnav">
     <ul>
      <li id="link_websitedesign"><a href="#websitedesign">Website Design</a></li>
      <li id="link_logodesign"><a href="#websitedesigntest">Logo Design</a></li>
      <li id="link_webshop"><a href="#">Webshop</a></li>
      <li><a href="#">Wordpress</a></li>
      <li><a href="#">Content Management Systeem</a></li>
      <li><a href="#">Search Engine Optimizing</a></li>
      <li><a href="#">Huisstijl</a></li>
      <li><a href="#">Slicen</a></li>
      <li><a href="#">Hosting</a></li>
     </ul>
     </div>
     <div class="text">
                     <div id="websitedesign">
                            <h3>Website Design</h3>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam iaculis vestibulum varius. Donec tempus aliquet sapien.</p>
                            <p>Fid cursus sapien malesuada sit amet. Duis facilisis, justo at lobortis mattis, lorem quam vulputate elit, id interdum lectus lectus ut velit. Cras lacus metus, tempor non scelerisque sit amet, pretium non sem. Aliquam fringilla accumsan condimentum. Duis eu commodo lacus. Vestibulum mollis augue nec ante consectetur pharetra. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean lacus mi, tincidunt vitae auctor luctus, facilisis non puru.</p>
                            <p><a href="#">Lees meer over ons</a></p>
                        </div>
     </div>
    </div>
    <div class="bottom"></div>
   </div>
 </div>
</div>

<div id="bottom">
 <div class="wrapper">
  <div class="top"></div>
  <div class="bg">
   <div id="mininav">
    <a href="index.html">Home</a>
    <a href="overons.html">Over ons</a>
    <a href="diensten.html">Diensten</a>
    <a href="werkwijze.html">Werkwijze</a>
    <a href="portfolio.html">Portfolio</a>
    <a href="contact.html">Contact</a>
   </div>
   <div id="services">
    <table>
     <tr><td><a href="#">Website Design</a></td><td><a href="#">Content Management Systeem</a></td></tr>
     <tr><td><a href="#">Logo Design</a></td><td><a href="#">Search Engine Optimizing</a></td></tr>
     <tr><td><a href="#">Webshop</a></td><td><a href="#">Hosting</a></td></tr>
     <tr><td><a href="#">Wordpress</a></td><td></td></tr>
     <tr><td><a href="#">Huisstijl</a></td><td></td></tr>
     <tr><td><a href="#">Slicen</a></td><td></td></tr>
    </table>
   </div>
   <div id="contactinfo">
    <table>
    <tr><td>Web:</td><td><a href="http://www.BMvisuals.nl">BMvisuals.nl</a></td></tr>
    <tr><td>MSN:</td><td>MSN@BMvisuals.nl</td></tr>
    <tr><td>Email:</td><td><a href="mailto:Email@BMvisuals.nl">Email@BMvisuals.nl</a></td></tr>
    <tr><td>Skype:</td><td>BMvisuals</td></tr>
    <tr><td>Tel.:</td><td>06 48 306 352</td></tr>
    </table>
   </div>
  </div>
  <div id="footer">
   <a href="http://www.bmvisuals.nl/">BMvisuals.nl</a>, Copyright 2010 - 2011&copy;. Alle rechten voorbehouden.
  </div>
 </div>
</div>
</body>

我真的没有任何线索。

日Thnx

2 个答案:

答案 0 :(得分:1)

您是否忘记将其包装在$(document).ready()事件处理程序中?

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

答案 1 :(得分:0)

put this below ur html 

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


or

jQuery(function(){

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


});