In response to Sérgio of estudio5.org this morning, i have created a jQuery script that does the same as the Prototype script i created a few weeks ago Ajax Content Load
This is the first time i have ever used jQuery, it is much more light weight, and unless you are using Prototype to its full potential, jQuery is perfect… I am thinking of using it alot more often!
Anyways, here is a link to the demo and a zip for everyones convenience!
jQuery Content Loading Demo
jQuery Content Loading ZIP
!! Don’t be tight, if you use this script, please reference me !!
80 Responses for "AJAX – jQuery Content Loading"
Jamie u RULE!!
This is great. Thanks alot, I’m gonna try and add this to my latest project, i’ll get back to u as soon as i can, so u can have a peak.
Thanks
Sérgio
Cheers, glad to help
Jamie! thanks for making the tutorial.. couldn’t have made this without it.. The problem is that I would need pull this one off without the rpc file… since I need to load lightbox etc scripts from the tab contents.. what you think could it be made?
Hi Niko,
Do you mean pulling data from a database?
I was in the middle of making that tutorial a few weeks ago but stopped, don’t know why.
I would assume you are using MySQL?
Jamie.
Jamie,
Thanks for the tutorial…Very cool stuff. I would also like to see how to do this with MySql if you have the time. Thanks!
how can it be done using pquery
Nice tutorial! It’s very simple.
I really like this piece of tutorial. I use it for my website. I got one question tho, when i put adsense code in the rpc3.php file it wont show. Now im not that good with php so if someone want to help me i would really appriciate.
Is it also possible to put all data in another .js file or standard html since my friend’s host don’t allow $_POST function as well as php? Feedback plse
Did you finish the pulling data from a database? I’m looking for a jquery and mysql tutorial, have you got it?
Thanks go ahead
It’s great stuff but I have some problems with transfering data in another languages, such a Russian, can you help me with that?
hi this is me suhail
this is sayed suhail here
It`s good, but how could one receive a page from a other domain? like http://www.google.com. It doesn`t seems to work (access denied). Help!
I’ve been thinking about using ajax to load the content portions of my site.
But if someone doesn’t have JS your stuffed, there really is no way to program redundancy loading of content if they dont have JS.
So we are back to square one.
Hi TheShadowNest,
To be honest the amount of people who do not have JS enabled on their browser is extremly small, so unless your website is dedicated to mobile browsers and WAP stuff, you should not have a problem…
According to this website only 4% of browsers do not have JS enabled, and from what i have read it is only spiders and mobile devices that really only fall into this category.
Jamie.
Hi im having problems on my webpage with ie, its ver 7.0.5130.11. It wont load the data but firefox works fine.
http://ctc.god-tools.com/politics/politics.php
all the test-links point to the ajax stuff. Id be greatful for any help.
4% can be a lot depending on how you look at it, IMO you shouldnt punish users for not having it.
The problem with loading content via js/ajax is it breaks the rules of unobtrusive scripting because if will adversly affect the user, it will prevent them from seeing your content. Instead of failing seamlessly behind the scenes.
Personally i would love to be able to load content via ajax, but again, i don’t think it is quite mature enough yet for it to fit inside the form/function box.
maybe one day though
nm i fixed it took me 4 days to realize i had an extra quote in there, firefox didnt care about it and ie choked.
Great tutorial..ill be waiting for the other good stuff
TheShadowNest: 4% is not a lot by any stretch. Think you need to re-evaluate why and how you’re doing things.
[...] called Nodstrum – A coders playground which had just the entry I was looking for! If you go to http://nodstrum.com/2007/03/20/jquery-content-loading/, you’ll find an example and the code needed to implement dynamic content loading using [...]
Sorry for being dumb, but can I add effects (slide/fade) to it? If so, how?
Many thanks.
@Nim:
Sure you can:
[code]
$("#nameDiv").fadeIn("slow");
[/code]
Replace nameDiv by the name of your DIV and voila…:)
Great tutorial. I’m going to test it on mysql though.
Peace.
I just tested it with mysql, it works like a charm. For people having troubles with it, here is a quick example:
info.php
[php]
[/php]
===============================
I’m pulling out all data from the database where the $id variable corresponds to the one I’m sending. (2 for this example)
===============================
Index.php
[php]
function appear(id) {
$(“#info”).load(“info.php?id=”+id+”");
}
Testing
==================================
Hope this will help someone.
Peace.
Sorry but the code on this page seems to change everything I wrote. Even the link is turned into a real link. Sorry Jamie for the trouble.
If anyone still having problems just leave a comment and I will try to explain it again.
Peace.
The content loads with a new session each time. How can i send session to the new contents form, etc…
And the same function code with the prototype shows an animated loading .gif. How can we put this property into jquery code.
Thank you very much for a great script. Now; we’re tryting to add it to our website, but we need the mainAreaInternal & mainAreaLoading into a respective table of our side. The problem it’s when we change the resolution of the browser, well, the position gets missed. For that, we try using ” margin:0 auto;”, but now when we test it the layer use a scroll and it looks ugly. There it’s any way to fix it to into a table, and get it out resolution issues? Thank you in advanced for support.
can I use thick box with this load method?? can u give sample , because I’m begiiner.
what about fade out/in effect
Hi,
Fantastic script this. I’m new to jquery too, and was hoping you’d be able to shed some light on how to FadeIn this content (and perhaps even fadeOut the content that was there before?!).
Many thanks for posting this and all your other helpful and insightful content.
Good morning!
I have a problem with this script. I have two documents, in firsrt.html I insert into documetn second.html with russian words, but instead of them is visible other symbols(((
Nice and simple
Great piece of code. I was wondering if it was possible to have have the div load content on a mouseover function. I would like to display content and information in a set div not a tooltip in my layout. Thanks any help would be appreciated.
Figured it out, the last post regarding the mouseover function. I’m such a noob at coding. But now that I’ve figured that out I’m having a bit of a problem adding extra content to the rcp php code. For example if I put case 4 in the php file and loadContent(4) it only displays the number 4. Is there anywhere else that I need to adjust to allow more pieces of content? Thanks Again
great one, just what i wanted and i used mysql too, also used the fadeout part, thanks
Hey guys,
Could I use this to load a picture ??
I would like to load text into a div and a picture into another div. I would like to specify picture via a parameter in the function…
How do I do that ?
Regards,
Ole (DK)
great scripts, i was trying to use them to load external urls but i guess you can’t do that
thx man!!! ^^
I need a huge reference to all of the cool jquery fx out there. My search starts today.
I like this tutorial and my first means of adding onto it is to incorporate a loader image while the external pages are being loaded.
Wish this few day old newb some luck!
R.
Hello, I have a problem with the script I need to change the Content-type since I run a Swedish website and some of the letters we have just get written out like this when I use the script ? so I need to change to the same as on my site but I haven´t succeded with this.
I have tried to change
contentType: “application/x-www-form-urlencoded”,
but I diden´t get it to work so I would really like some help what I need to change on the site. I need to use UTF-8 or
Does anyone know what I need to change to get it to work. But I also have to write thanks alot for this script except my problem it works wonderfully
Hi, great tutorial. Works great. Is this an SEO friendly method? I am trying to avoid using iframes for that very reason. If anyone can help me by just using php or an SEO friendly method – it would be greatly appreciated!
Hi folks
This week i will write someting about Jquery on PHP Magazine
about this matter
I will add comments in portuguese and english
Regards
Franco
Is there any explanation on how to load en external html file instead of using divs?
Excellent script !
Thanks a lot for sharing it.
looks good for text. anyone has a way to load different FLV/swf file for each “tab” link?? thank you!!!
sxdjiurjifpngzsfwell, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch
This script is great, except it doesn’t work with IE on OnClick event. In IE it works only with
How to add loading image
I love the script but if i load a page that uses javascript into the div via ajax my js doesnt work in the loaded page!!! any ideas?
Serge,
Make sure that your DIV is properly Id’ed
ex:
So it knows where to target the output.
Thanks. I tried doing this with mootools when jquery was already running. Wasn’t having any of it :p
thanks…very good tutorial…
What that was rental car insurance mexico .inexpensive car insurance in ne because direct line car insurance auto insurance companys ,Cool stuff – low car insurance rates for tee
in the attached Here texas health insurance This is is the same as ontario car insurance companies .which contains all of the brownsville cheap car insurance quotes online car insurance zebulon north .
TTTThanks
Hi,
Is there a way to load html content (from an external file) into a regular javascript variable (instead of div)?
asasas
Excellent Source.
CEO Innovative Consulting
http://www.groupiconsulting.com
[...] AJAX jQuery Content Loading Nodstrum Posted by root 45 minutes ago (http://nodstrum.com) Mar 20 2007 if anyone still having problems just leave a comment and i will try to explain it again what that was rental car insurance mexico inexpensive car insurance in ne because direct line car insurance auto insurance companys cool copyright 2007 nod Discuss | Bury | News | AJAX jQuery Content Loading Nodstrum [...]
I have installed this script once (not in this current page) but found out that when i tried to click twice on a link the second time the page is not loaded in Internet Explorer.
Any clues?
Kind regards,
Barry
Forgot to mention that i use something similar on :
http://www.dekralenhoek.nl/shop
Thank you for the information sharing.
CEO Innovative Consulting
http://www.groupiconsulting.com
Excelente. Se agradece. Me servira mucho.Saludos
Thanks Bro, i’ve used it.. but when i try to load div that have video online inside, my page disappear.. maybe you can help me fix my issue,, thanks in advance
-Boy-
Hi!
Is it possible to adapt the script, so we can use the BACK button of the browser again?
Please, this would be very important.
This script has no back/forward button funcionality and no bookmarking features. Therefore it’s pretty useless for the majority of developers.
Any modification possible?
Best regards
thnks
Hello Jamie,
Nice tutorial.
You did it simply superb.
Javascript is fun to programmers now.
Thanks and regards,
Amol Bhavsar.
Is not spam, it is only my commercial offer. Sorry if i mistake of topic!
Buy Clomid – Best testimonials. Buy now. Satisfaction is guaranteed.
Best price for brand and generic medications.
From $0.60 per item. Free Airmail shipping for Clomid 100mg 90 tabs and save $135 on order!
Hi Dear,
I have a question about your AJAX – jQuery Content Loading.
I want use next step to go other page in Div without refreshing all of page and only div who has content refresh.
is it posible in your script?
Nice layout
nice tutorial
i have a question how can i set the tab as current so that it won’t change the content on refresh???
nice tutorial,thanks, webtasarimp.com
Great tutorial and easy too thank you .
???? ???????
http://0gate.com
Jamie – really nice!
Have you ever done anything with AJAX and mouseovers to pull data from a MySQL database?
I am pulling IDs from my db, into a and I have a table on my page, and a hidden div with the same table. If i click on an ID, I get the record values to fill into the table, works ok, but I want to hover over an ID and see the rest of the record in a now ‘un-hidden’ div.
Any ideas?
sorry – pulling ids into a ul
try to add a fade in fade out effect !!!!!! I have one in spry
.
My problem is that I want to pass not one (id) variable byt two, for example ther is rpc.php?o=”+id+” I want to have something like rpc.php?o=”+id+”b=”+name+”
Can You help me with this?
I am also looking to use this by pulling content from a database (MySQL). Any help would be awesome!
(also as someone mentioned the ability to record which tab the user is on/has visited would be extremely useful for forward/back navigation)
Great tutorial!
FAR Better than what I was looking for, absolutely perfect!
jQuery is COOL and easy, I’m just figuring out if I preffer this or mootools.
thanks alot man, you are a saver!
Hey man!
Listen to me, i am read now in hotscript, your comment. You say to “jQuery – Load external content into div
”
Siteusing the lightweight jQuery library to load external content into a div! Simple to follow
I am reading now your page but i dont see “external page loading”!
You are very bad!
Leave a reply