开发者

Jquery ajax load problem

开发者 https://www.devze.com 2023-01-17 15:51 出处:网络
Why doesnt this work? $(\'#websitedesign\').load(\'test.html\', function() { alert(\'Load was performed.\');

Why doesnt this work?

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

Jquery version using: 1.3.1 min

html code:

<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="#">Slic开发者_如何学Pythonen</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>

I really dont have any clue.

Thnx


Did you forget to wrap it the $(document).ready() event handler?

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


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.');
});


});
0

精彩评论

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