473,382 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

i want to display the related data on clicking the respected subcategory

Actually i have the two divs on left side div i will dispaly the subcategories.Then if we click on the any of the subcategory it should display the related data in right side div without page refreshing.

Now actually what i want is how to make the that subcategories is in href and on clicking that we want to take the data from database to display.please help me
this is my code
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>example</title>
  4. <style>
  5. #header{
  6.         background-color:#c3dfef;
  7.        }
  8. #footer
  9.             background-color:#ccecd8;
  10.             margin:5px; 
  11.             display: block; 
  12.             clear: both; 
  13.  } 
  14. #sidebar-left
  15.                 background-color:#D0D0D0 ;
  16.                 float: left; 
  17.                 width:250px;
  18.                 height:530px;
  19. }
  20.  
  21. #content
  22.                 background-color:#ccdff0;
  23.                 height:530px;
  24. }
  25. div{
  26.   padding:10px;
  27.   border:solid 1px black;
  28. }
  29. .button2:hover {
  30.         text-decoration: none;
  31.         background: #007ead;
  32.         background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
  33.         background: -moz-linear-gradient(top,  #0095cc,  #00678e);
  34.     }
  35. </style>
  36. <body>
  37.  
  38.  <script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
  39.  
  40.  <script>
  41. jQuery(document).ready(function() 
  42. {
  43.     jQuery.ajax(
  44.     {
  45.         type: 'GET',
  46.         url: 'Youtube_category.php',
  47.         dataType: 'JSON',
  48.         success:function(data)
  49.         {
  50.                     for(i=0;i<jQuery(data).length;i++)
  51.             {
  52.                 $('#parentCategory').append('<option value = '+ data[i].categoryName+'>' + data[i].categoryName + '</option>');
  53.             }
  54.         }
  55.     });
  56. });
  57. </script>
  58.  
  59. <script>
  60. jQuery(document).ready(function() 
  61. {
  62.     jQuery('#parentCategory').change(function()
  63.         {
  64.         jQuery("#subCategory").load("subCategory.php?choice="+jQuery("#parentCategory").val());
  65.     });
  66. });
  67. </script>
  68. <script>
  69. function showDiv() {
  70.     var SubCategory = document.getElementById('subCategory');
  71.  
  72.     for (i = 0; i < SubCategory.options.length; i++) {
  73.         document.getElementById('sidebar-left').innerHTML += SubCategory.options[i].value + "<br/>";
  74.     }
  75. }
  76. </script>
  77.  
  78. <!-- <script>
  79. function showDiv() {
  80.  
  81.                        document.getElementById('sidebar-left').style.display = "block";
  82.                        var index = document.getElementById('subCategory').selectedIndex;
  83.                        var selectedText = document.getElementById('subCategory').options[index].innerHTML;
  84.                        document.getElementById('sidebar-left').innerHTML = selectedText;
  85.  
  86.                     }
  87. </script> -->
  88.  
  89. <script>
  90. $(document).ready(function() {
  91.      $('body').on('click', '#sidebarleft', function() {
  92.  
  93.     $("#display").load("vedio_details.php?Id=1");
  94.  
  95.   });
  96. });
  97. </script>
  98. <form id="form1"> 
  99. <div id="header" > 
  100.  
  101.     <select id="parentCategory" value="parentCategory" class="button2" name="category">
  102.         <option selected="selected" name="category" value="selected">--Select category--</option>
  103.     </select>
  104.     <select id="subCategory"  class="button2" name="subCategory">
  105.         <option selected="selected" name="subCategory" value="selected">--Select subCategory--</option>
  106.  
  107.     </select>
  108.  
  109. <input type="button" name="answer" value="Go" class="button2" onclick="showDiv()" />
  110.  
  111.  </div>
  112.  
  113.  
  114. <a  id="sidebarleft"  href="vedio_details.php" class="sidebr">
  115. <div id="sidebar-left" ></div>
  116. </a>
  117. <div id="content"> content </div>
  118. <div id="footer"> footer </div>
  119. </div>
  120. </head>
  121. </form>
  122. </body>
  123. </html> 
Feb 23 '14 #1
0 1290

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: StepH | last post by:
Hi, I'm building a little application, which the goal is to: 1./ Collect data via Serial line and or via a file (for playback). 2./ Display these data as graph, oscilloscope, ... How manage...
2
by: Simon Callan | last post by:
I'm trying to implement a WAP Push Protocol Gateway, using Push Access Protocol over HTTP, and I'm having problems. Ignoring all the buzzwords, my CGI program receives a post something like: ...
0
by: Scanner2001 | last post by:
I am researching some options for loading hierarchically related data from xml into an sql server database. I do not have the primary keys in the source xml files. The primary keys are identity...
2
by: Jim in Arizona | last post by:
Usually, If i need special formatting, I don't use the datagrid control and use a loop that processes a table for each record read from the database (as in classic asp) like so: ...
1
by: Jason Chan | last post by:
Some chinese characters data (in Big5 encoding) is stored in database. I tried to display the data in an aspx but the characters cannot display correctly. I tried anything I think is related: -...
2
by: Bob | last post by:
I got three related datagrid views one parent and two children of the same. The two child tables contain many thousands of records and some of the contents are bitmap files in a sql server...
3
by: Aaron | last post by:
Hi, It is possible to establish relationships between tables within a dataset and this allows some useful features. For example, given a row from a table you can use GetParentRow,...
2
by: swaggerking | last post by:
First off, I'm using Dreamweaver and an Access db. Second, I'm a novice. I have two tables in my db: "tdClients" & "tdClientInvoices". The only relation/common denominator in each table is the...
19
by: Mel | last post by:
I want to display custom data in some sort of control on a web page. By custom data I mean it's not in a database yet it just resides in a List Box on a different tab . I just want to display the...
21
Mas Juliza Alias
by: Mas Juliza Alias | last post by:
Hi, I am building a program on Information System for Reservoir Operation for my Masters research. Now I have a text file which is an output file from a processing software (Terramodel) that lists...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.