| | |
Easy as for jQuery GURUS!
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2009
Posts: 23
Reputation:
Solved Threads: 0
Hi guys, I spent the whole day (thats 8 hours straight) trying to get a simple jQuery function to work but failed miserably!!! I very very new to the jQ scene and I know I have a lot of catching up to do!
Could somebody get this to work for me ???
All i want is when user clicks is:
1.the box with info fades out
2. when data returned from the database the box fades in with the new data!
What happens now is while the box fading out i can see new set of data already loaded and thats a complete FAIL of what I interned to do. ANY HELP IS GREATLY APPRECIATED! Peace.
Could somebody get this to work for me ???
All i want is when user clicks is:
1.the box with info fades out
2. when data returned from the database the box fades in with the new data!
What happens now is while the box fading out i can see new set of data already loaded and thats a complete FAIL of what I interned to do. ANY HELP IS GREATLY APPRECIATED! Peace.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
$(document).ready(function() { $("ul.sc_menu a").click(function() { $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"}); $.post('projects-agent.php', {'title': $(this).text()}, function(data) { $('#content #mainbg #infobox #trackinfo').html(data); $('#content #mainbg #infobox #trackinfo').animate({opacity:"1"}); }); return false; }); });
Last edited by peter_budo; 31 Days Ago at 5:15 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
0
#2 34 Days Ago
It is possible to attach a callback function to the animate() function. This callback is called after the animation is done. Put your post in that function. See http://docs.jquery.com/Effects/animate
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Jul 2009
Posts: 23
Reputation:
Solved Threads: 0
0
#4 34 Days Ago
This is what I've tried and it didnt work

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
$(document).ready(function() { soundManager.debugMode = false; $("ul.sc_menu a").click(function() { //$('#mainbg').fadeOut("slow"); $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"},function(){$.post('projects-agent.php', {'title': $(this).text()},function(data){$('#content #mainbg #infobox #trackinfo').html(data);$('#content #mainbg #infobox #trackinfo').animate({opacity:"1"})}); ; threeSixtyPlayer.init(); }); return false; }); });
•
•
Join Date: Jul 2009
Posts: 23
Reputation:
Solved Threads: 0
0
#5 34 Days Ago
This is what I've tried and it didnt work

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
$(document).ready(function() { soundManager.debugMode = false; $("ul.sc_menu a").click(function() { //$('#mainbg').fadeOut("slow"); $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"},function(){$.post('projects-agent.php', {'title': $(this).text()},function(data){$('#content #mainbg #infobox #trackinfo').html(data);$('#content #mainbg #infobox #trackinfo').animate({opacity:"1"})}); ; threeSixtyPlayer.init(); }); return false; }); });
0
#6 34 Days Ago
javascript Syntax (Toggle Plain Text)
$(function(){ $("ul.sc_menu a").click(function() { $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"}, function(){ alert('animated'); $.post('projects-agent.php', {'title': $(this).text()}, function(data){ alert(data); $('#content #mainbg #infobox #trackinfo').html(data); $('#content #mainbg #infobox #trackinfo').fadeIn('fast'); }); }); return false; }); });
They should be cleaned up. Are you sure the php file is returning a http 200 and data? Also, I'd try to make sure you audioplayer is present.
CodeJoust! Design + Development - Proud User of Ubuntu
•
•
Join Date: Jul 2009
Posts: 23
Reputation:
Solved Threads: 0
0
#7 34 Days Ago
•
•
•
•
Do the alerts go off with the code? It looked like a few syntax errors...javascript Syntax (Toggle Plain Text)
$(function(){ $("ul.sc_menu a").click(function() { $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"}, function(){ alert('animated'); $.post('projects-agent.php', {'title': $(this).text()}, function(data){ alert(data); $('#content #mainbg #infobox #trackinfo').html(data); $('#content #mainbg #infobox #trackinfo').fadeIn('fast'); }); }); return false; }); });
They should be cleaned up. Are you sure the php file is returning a http 200 and data? Also, I'd try to make sure you audioplayer is present.
0
#8 34 Days Ago
May this help
javascript Syntax (Toggle Plain Text)
$(document).ready(function() { $("ul.sc_menu a").click(function() { $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"}); $.post('projects-agent.php', {'title': $(this).text()}, function(data) { //$('#content #mainbg #infobox #trackinfo').html(data); $('#content #mainbg #infobox #trackinfo').animate({opacity:"1"}, function(){this.html(data)}); }); return false; }); })
When you think you have done a lot, then be ready for YOUR downfall.
0
#9 34 Days Ago
Even better:
javascript Syntax (Toggle Plain Text)
$(document).ready(function() { $("ul.sc_menu a").click(function() { $('#content #mainbg #infobox #trackinfo').animate({opacity:"0"}, function(){ $.post('projects-agent.php', {'title': $(this).text()}, function(data) { $('#content #mainbg #infobox #trackinfo').html(data); $('#content #mainbg #infobox #trackinfo').animate({opacity:"1"}); }); return false; }); }); })
When you think you have done a lot, then be ready for YOUR downfall.
![]() |
Similar Threads
- cancelling jquery timeouts (JavaScript / DHTML / AJAX)
- create a form with a post (PHP)
- News Story: Microsoft shows JQuery some love (Windows Software)
- Error Loading operating System (Windows NT / 2000 / XP)
- An offering to the Internet Nasty Gurus (Viruses, Spyware and other Nasties)
- Make Sure Downloaded Files Are Easy to Find Later (Windows tips 'n' tweaks)
- Prosearching.com / Easy Search (Viruses, Spyware and other Nasties)
- Easy Way to Adjust LargeSystemCache (Windows tips 'n' tweaks)
- Tutorials for Linux (*nix Software)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: mailto error handling
- Next Thread: Password Encrypter
| Thread Tools | Search this Thread |






