30 March 2009 ~ Comments Off

Loading content with JQuery

Loading content via Ajax is quick and easy with JQuery. If you have never used jQuery before you might think twice about it!

Below is my html where we will load the content.

1
<div id="LoadContent"></div>

Now lets look at the javascript needed to load a remote page in.

1
$("#LoadContent").load("path/to/remote/file.php");

After that is called the contents of “file.php” would be loaded into the div above! Quick and easy way to include item into your app. You may also pass variables to the page like so:

1
$("#LoadContent").load("path/to/remote/file.php", {id: 1, name: "Greg"});

Hope this small tool helps change your mind about JQuery!

Tags: ,

Comments are closed.