Download Ajax dynamic content script

Demo

Bookmark and Share

Licensing

This script is distributed under the LGPL open source license.
Commercial licenses are also available. Some of these licenses also includes personal e-mail support for up to 1 year.

Download files

You can download the script from this Zip file.

Files in package:

  • ajax-dynamic-content.html = Demo HTML file which illustrates how to use this script.
  • js/ajax.js = Ajax (SACK library)
  • js/ajax-dynamic-content.js = Main JS file for this script
  • images/* = Images used in this demo
  • external/* = Dynamic loaded files for this demo

How to use this script

This scripts loads content of external files into a HTML element on your page. This is simply done by calling the Javascript function ajax_loadContent. Example:

ajax_loadContent('news1','external/externalfile1.html');

This will load the content of the file external/externalfile1.html into the HTML element on your page with id "news1", example: <DIV id="news1"></DIV>

Note! Ajax scripts must be executed over http and not the file system. I.e. from address starting with http://... and not C:\...

Update log

  • December, 3rd, 2006 - Javascript parser has been improved because of problems executing code in global context

Comments

Tom Walsh
Does not work

Says Loading content - please wait
Tom Walsh at 12:14PM, 2011/03/03.
Admin comment
DHTMLGoodies
Tom,

Take a look at this post:

http://www.dhtmlgoodies.com/forum/viewtopic.php?f=30&t=568

Hopefully, you'll find a solution to your problem there.
DHTMLGoodies at 06:02AM, 2011/03/07.
Pritee
Still not working
Pritee at 06:51AM, 2011/03/24.
Pritee
Its not working locally but when you upload on your server its work :) Thanks!
Pritee at 07:01AM, 2011/03/24.
Nico
Does it work with post requests?

Thanks
Nico at 05:57PM, 2011/05/10.
Greg Giddings
Can you link between the divs?
Greg Giddings at 05:59AM, 2011/06/11.
aneta
Its not working on the server on Firefox and Opera. It's good only for IE.
aneta at 02:28PM, 2011/06/12.
Admin comment
DHTMLGoodies
Aneta,

It's working perfectly in my Firefox in Opera. Which problems do you experience? Any error messages ?
DHTMLGoodies at 07:25AM, 2011/06/15.
Aneta
Oh, sorry. It was my mistake. Now it's good. Here are my attempts:
http://komentarz.byethost7.com/street
Regards :)
Aneta at 03:22PM, 2011/06/15.
tracy
Just says "Loading content - please wait" the entire time. I can't get example to work. I changed to GET method , too. still doesn't work.
tracy at 11:16AM, 2011/06/27.
Admin comment
DHTMLGoodies
tracy wrote: #
Just says "Loading content - please wait" the entire time. I can't get example to work. I changed to GET method , too. still doesn't work.


Tracy,

How do you open the page in your browser? Do you use an address starting with http:// or is it starting with file:// ?

Ajax scripts only works with http.
DHTMLGoodies at 07:41AM, 2011/06/28.
um
Why isn't it working when calling ajax_loadContent(...) in a loop?
um at 04:54PM, 2011/08/02.
Pierre
Hello !
I need to use checkbox and radio buttons for this form but it don't works...!
How could I do ?

Thanks
Pierre at 08:08AM, 2011/09/09.
Ahmad Rameen
thanks it is good, but can you add a sidebar in this, that it must also change in different pages.
thanks
Ahmad Rameen at 03:54AM, 2011/10/19.
Michael Owen
This is what I am trying to do! I have a php script, by default it gets all results from the database... this is loading perfectly with this script. What I would like to do is have a search form (method post) where users can narrow their results with search criteria. the search works great outside of the dynamic content script but I would like it to update the content div with the results of the new query. any tips on how I could implement this.
Michael Owen at 01:43PM, 2011/12/04.
yeli
does anyone can help me I want to use this script in my J2EE project I am under jsf 2.0 and I see my pages for external components does not work with jsf components against simple html works well.
example <h:inputText value="Merci"/> does not work and <input type="text" value="Merci"/> works well.
yeli at 10:55AM, 2011/12/09.
Etienne
We are using the Ajax dynamic content script and all is working BUT when we are loading an php ore html page with Frence, Spanish, German contex all the words whit special carracter like ^, accents etc will be shown with a ?.
How can we let shown this correctly?
Thanks in advance
Etienne
Etienne at 11:31AM, 2012/05/24.
Markus Ebeling
Hi,

nice script!

Is st also working with anchors?

Something like:
<a href=\"#anchor\" onclick=\"ajax_loadContent('log','include/layer/login.php');return false\">

or:

<a href=\"#\" onclick=\"ajax_loadContent('log','include/layer/login.php#anchor');return false\">

Thx
Markus Ebeling at 08:40AM, 2012/08/17.
Ria
How can i add a new html section in a existing html section using ajax and dojo?
Can anyone help me? its urgent.
Ria at 07:16AM, 2012/11/21.
alf
Hi,
great work by the way!!
Would it be possible to link some file in Sugar Sync or Google drive? I tried but did not work!
Tnx
alf at 03:27AM, 2012/12/20.
Felipe
Could you put the example working on production?
Felipe at 06:24AM, 2013/01/31.
Diego Carlos
I'ts Working! Thx!
Diego Carlos at 12:58PM, 2014/06/16.
Etienne
Hi
Can I make a link to a page on an other site in the script?
So yes how I must do that?

Thanks in advance
Etienne at 05:48AM, 2014/09/24.

Post your comment

Don't have an avatar? Create one at Gravatar.com.

Confirmation code:

Go to cbolson.com


About/Contact | A good idea? | Submit a script | Privacy notice
© 2005 - 2016 dhtmlgoodies.com