I am using jQuery
. My main page is index.php
. on load of this page. How do i load another page internally. say a small block in the page ?
views:
87answers:
2
+9
A:
Like this: $('.smallBlock').load('targetUnderSameDomain.php .anotherSmallBlock');
In the first part you select the block where you want to insert the block of the targeted file. The load function has two parts: The first part is where you select the targeted file, the second is optional, but there you can select an element within the targeted file's html.
Hope your accept rate will grow through this answer ;)
Nort
2010-05-16 12:06:17
+2
A:
you can use the load command. For a simple page like this:
<html>
<head>
<title>test</title
</head>
<body>
<div id="content"> </div>
</body>
</html>
you could fill the Div with id = content like this:
$('#content').load('yourUrl.php');
Hope this helps you and be sure to accept if it does ;)
EDIT: changed from get() to load()
the syntax for the get command would be:
$.get('yourUrl.php', function(data){
$('#content').html(data);
});
Falle1234
2010-05-16 12:06:48
[`.get()`](http://api.jquery.com/get/) is a different function, you want [`.load()`](http://api.jquery.com/load/) here :)
Nick Craver
2010-05-16 12:10:08
yeah your right... guess my brain doesn't work that well on a sunday ;)
Falle1234
2010-05-16 12:12:16
y cant we use .get() over here...that will also fetch data rite ?... can i pass parameters to .load() function?
pradeep
2010-05-17 05:14:11