By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,526 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

load() function in jquery not working

P: 1
hi there guys im currently working on a project with jquery...
the thing is.. i need to change the contents of a div named "sub2" with the contents of "pets.html"... i've read some tutorials and i thought the best way to do this is through the use of jquery... so here's my code...
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="jquery.js"></script>
  2. <script type="text/javascript">
  3. function contentDisp()
  4. {
  5. $.ajax({
  6. url : "pets.html",
  7. success : function (data) {
  8. $("#sub2").html(data);
  9. }
  10. });
  11. } </script>
my image which is supposed to be clicked contains this
Expand|Select|Wrap|Line Numbers
  1. <a id="pets" onClick="contentDisp()"><img src="images/pets.png" id="pets"/></a>
the code is working ., but when i transfer my codes to netbeans with Tomcat running the code didnt work ...

is there anyone here who knows what's wrong or what should i do with my code? thanks in advance
May 2 '11 #1
Share this Question
Share on Google+
2 Replies

P: 1,059
get read the javascript error from the console and see what error you can see
May 9 '11 #2

P: 45
hi xiiopao
replace your function with the following
function contentDisp()

this would work if you have loaded jquery file, else you would get it from here
Dec 23 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.