Jump to content

jQuery and external load content


kvnmck18

Recommended Posts

I am trying to figure out how to use jQuery with an external php file that uses variables to load mysql database. The data from the database are used in a dynamic/conditional drop-down menu/navigation.This is going to be used for a complex Site map. The Site map will have all the "main" pages' titles, when a "main" page is clicked it will show a unhide a hidden <div/> and load the Sub-pages' titles in this <div/>. These sub-pages' titles will be click-able to show sub-sub-pages' titles in another hidden <div/>. Also if you move away from the <div/>s they fade out.Any ideas?

Link to comment
Share on other sites

I believe all of those examples are pulling external content, what's your question? jQuery has some things built in to it and help with AJAX requests and getting data, I'm sure the examples are using those to load the data to show in the menu.

Link to comment
Share on other sites

Here is my start. It shows two links to start. When you click the links it pulls sub links.... but I can't get the sublinks to open then subsub links. I can't get that to work.

<script type="text/javascript" src="jquery-1.2.6.js"></script>	<script type="text/javascript">		$(document).ready(function() {			$("span.Selecter").click(function(){				var IDvar = this.id;				$("div#ResultShow").fadeIn("slow").addClass("here").wrap("<div class=\"wrap\"></div>").load("request.php",{ID:IDvar});		   			});  		});	</script>	</head><body>	<div style="float: left;">		<span class="Selecter" id="1">		Show 1		</span>		<br />		<span class="Selecter" id="2">		Show 2		</span>	</div>	<div id="ResultShow">	</div>	<div id="ResultShow2">	</div></body>

Link to comment
Share on other sites

The request is in the right from the server - it is a links that are just spaced with line breaks. When these links are clicked it opens another <div/> to the right of that.

Link to comment
Share on other sites

They have a new class. So the jQuery would have a filter() to call these "sublinks".The main problem I am having is that once it makes the 1st request, how can I have these new links call back to the javascript to then call the next set.It's easy to make the initial request, but the request of the request is the problem. I know how to do this when all the code is actually in the source (And elements are just hidden) but I don't want that because the source code would be way too long.

Link to comment
Share on other sites

Well, I can get it to work if I put a script in "external" doc request. But I feel like this is a messy solution.

Link to comment
Share on other sites

How about this question...How do I use "less than" "<" in a jQuery statement? I'm trying to say when this (a number) is selected only show items that are "less than" that selected value.

$("span.com[@name<=200]").fadeIn("slow");

"name" attribute contains a number. For demo purposes the code above is just using a static '200'. The statement above works when it's:

$("span.com[@name=200]").fadeIn("slow");

^^^^^^^^^^^^^^^^^^^^^^^^^^^...which only brings up items with name="200". But I also want it get items less than '200' too.hmmm????

Link to comment
Share on other sites

I don't know, I haven't used jQuery. You might have to use a different way to fade everything in, there might be another way with jQuery to get all spans with the right class and then you loop through them yourself and check if they are less than or equal and then do the fadeIn for each one. jQuery might have another way to do that, I just haven't used it so I don't know. The answer would be in the documentation though.

Link to comment
Share on other sites

I can't find anything about using "<" (less than) to get results with jQuery. It's frustrating me.

Link to comment
Share on other sites

I am actually starting a new topic because I have drifted away from my original topic.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...