I want to make a webpage in which three different contents show/hide when a button is clicked. The code is shown below.
I want the same page to show three contents:
- only a search bar when button 'search' is clicked,
- only the result of the search after a search is done or when the button 'results' is clicked, and
- only the visualization of the search when one specific outcome of the results is chosen, or when the button 'visualization' is clicked.
Right now I only know how to show the results in different pages, not in the same one hiding what I don't want.
Code is below.
Thanks
<html lang="en">
<head>
  <title>Test</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="">
  <link rel="shortcut icon" href="docs-assets/ico/favicon.png">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <link rel="stylesheet" href="css/bootstrap-theme.min.css">
  <link href="css/jumbotron-narrow.css" rel="stylesheet">
  <link href="css/jquery.dataTables.css" rel="stylesheet">
  <link rel="shortcut icon" type="image/ico" href="" />
  <script src="js/jquery-1.10.2.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script type="text/javascript" language="javascript" src="js/libs/jquery-2.0.3.min.js"></script>
  <script type="text/javascript" language="javascript" src="js/libs/jquery.sprintf.js"></script>
  <script type="text/javascript" language="javascript" src="js/libs/jquery.dataTables.min.js"></script>
  <script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
      //xmakeTable("treaty");
    });
    makeTable = function(query) {
      var q = encodeURIComponent(query)
      $('#example').dataTable({
        "oLanguage": {"sSearch": "Filter results:"},
        "bProcessing": true,
        "bDestroy":true,
        "sAjaxSource": $.sprintf('http://leela.sscnet.ucla.edu/voteview/searchdt?q=%s',q),
        "aoColumns":[{"mData":"id", "sWidth": "20px", "sTitle":"ID"},
          {"mData":"chamber", "sWidth": "10px", "sTitle":"Chamber"},
          {"mData":"date", "sWidth": "85px", "sTitle":"Date"},
          {"mData":"yea","sTitle":"Vote","sWidth":"80px"},
          {"mData":"descriptionShort", "sWidth": "200px","sTitle":"Description"}],
        "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
          $('td:eq(0)', nRow).html(
          $.sprintf('<a href="http://leela.sscnet.ucla.edu/newmap/index.html?id=%s">%s</a>',aData['id'],aData['id'])).attr("title","Click to explore this vote");
          $('td:eq(3)', nRow).html(
          $.sprintf('%s-%s',aData['yea'],aData['no']));
          $('td:eq(4)', nRow).attr("title",aData['description'])
          return nRow; }
      });
    }
    searchvotes = function() {
      $('#example').empty();
      makeTable($('#qqtext').val());
    };
  </script>
</head>
<body>
<div class="container">
  <div class="header">
    <ul class="nav nav-pills pull-right">
      <li><a href="home.html">Home</a></li>
      <li class="active"><a href="search.html">Search</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
    <h3 class="text-muted">VoteView</h3>
  </div>
  <div class="jumbotron">
    <div class="container">
      <div>
        <h3 align="center">Search for Roll Calls</h3>
        <div class="col-sm-12">
          <input type="search" class="form-control" placeholder="Search" id="qqtext" onchange="searchvotes()"></input>
        </div>
      </div>
      <br>
      <div>
        <div class="table-responsive">
          <table id="example" class="table table-striped"></table>
        </div>
      </div>
      <div>
        <div class="col-lg-14 col-md-14 portfolio-item" id="example">
        </div>
      </div>
    </div>
  </div>
  <div align="center">
    <button type="button" class="btn btn-primary btn-lg">
      <span class="glyphicon glyphicon-search"></span><br><a href="search.html"><font color="white">Search</font></a>
    </button>
    <button type="button" class="btn btn-success btn-lg">
      <span class="glyphicon glyphicon-list"></span><br><a href="results.html"><font color="white">Results</font></a>
    </button>
    <button type="button" class="btn btn-warning btn-lg">
      <span class="glyphicon glyphicon-eye-open"></span><br><a href="results.html"><font color="white">Visualize</font></a>
    </button>
  </div>
  <br>
  <hr>
  <p></p>
  <footer>
    <p>Example</p>
  </footer>
</div>
</body>
</html>
If one tries a search with this code, the code should show results, but not the way I expect.
Thanks
 
     
     
     
    