View Single Post
Old 12-19-2012, 12:52 PM   PM User | #1
Webbot
New Coder

 
Join Date: Dec 2012
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
Webbot is an unknown quantity at this point
Load div content from other pages depending on select choice

Hi!

I try to load content into my site from other pages (in same site) but its not working.

I made four pages in same root:

Index.html

one.html
two.html
three.html

In Index I have a select element with ID "selectchoice":

Code:
<select id="selectchoice>
<option>Select a choice</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
I also have a div in Index with id "get_content":

Code:
<div id="get_content"></div>
When I change the select element to option 1 or 2 or 3 I want to load one.html or two.html or three.html into the div get_content.

Then I place this code in the header if Index.html, after the jQuery-file link.

Code:
<script>
$("#selectchoice").change(function(){
    $("#get_content").load("");
    $("#get_content").load("one.html");
    $("#get_content").load("two.html");
    $("#get_content").load("three.html");
});
</script>
And then I run the site (on a server with other load-scripts thats works on the same site), but its not working. What am I doing wrong? :/

Kinda new to scrips and programming so do not be suprised if there is any standard error.

Is anybody find the error?
Webbot is offline   Reply With Quote