How to include a file with jquery?

I am wondering what is the jquery equivelent to php's include:

include 'sidebar.php';

I have a link:

<a href="">+ Add A Sub Category</a>

But I am not sure what I would set the href to in order to get the included file.  Anyone got some advice for this?
FairyBusinessAsked:
Who is Participating?
 
ProculopsisConnect With a Mentor Commented:

The load method should do what you want:

js:
$("#load-me").load( "http://www.google.co.uk/" )

html:
<div id="load-me"></div>
0
 
Lukasz ChmielewskiCommented:
0
 
FairyBusinessAuthor Commented:
Ok, I changed my function to this:

$("#sub").click(function() {
      content = "<div class='sub'></div>";
      $('#add').html(content);
      $(conent).load("sub.php")
      $('#content').fadeIn('slow');  
});


My thought is every time my link (#sub) is clicked

 <a href="" id="sub">+ Add A Sub Category</a>

It would add a div to my form

Then it would load the included file into that div with a class of sub.

Then it would finally fade the div in.  The reason I am doing it like this is because there may be many sub categories so I need it to be able to be entered in to the form multiple times.  But its not working.  Any ideas on how I could achieve this?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
FairyBusinessAuthor Commented:
Here is the function in my library (I didnt get very far with it yet)

function update_materials() {
	global $conn, $message, $errors, $error;
	if(empty($errors) && isset($_POST['submit'])) { // Perform Update
		$materials = $_POST['materials'];
	}
}

Open in new window


0
 
FairyBusinessAuthor Commented:
Nevermind that comment was suppose to be for another question. ..
0
 
FairyBusinessAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.