1

I have a dropdown list like

<h1>IMy Search Engine</h1>
<form id="formid">
<select name="days" id="selectid" onchange="check()">
    <option value="">choose</option>
    <option value="thirty.php">Last 30 days</option>
    <option value="sixty.php">Last 60 days</option>
    <option value="ninety.php">Last 90 days</option>
    <option value="calender.php">custom</option>
</select>
</form>

With each option display another web page in next window. I want to show another web page in the same window using show() hide() jqueries. Anybody help?

Incredible
  • 3,495
  • 8
  • 49
  • 77
Rizvi
  • 287
  • 3
  • 14
  • Thats not how `show` or `hide` work. They work be revelaing hor hiding DOM elements already on the page. You probably want to be using ajax to update the contents of a `div` on the page with the select list – Jon P Apr 09 '14 at 05:45

3 Answers3

0

Do this:

document.getElementById('selectid').onchange=function(){
   if(this.value){
     window.location=this.value; 
   }
};
Amit Joki
  • 58,320
  • 7
  • 77
  • 95
0

der r several ways to do this:

1) Option

use a iframe and update its src="dynamic url" on change of select.

2) Option

use jquery ajax to get dynamic contents and set as html in the div or whatever html element u want.

Community
  • 1
  • 1
0
    // In your current page append following code
    // this section hold your new page value
   <pre>

   </pre>

   // In jquery
   <script>

     $(document).ready(function(){

        //change event of dropdown

         $('#selectid').on('change',function(){

              $this = $(this);
              if( $this.val().length )
              {
                  // ajax call to get file contents
                  $.ajax({
                     url    :  "getFile.php",
                     type   :  "POST",
                     data   :  {'page':$this.val()},
                     success:  function(n)
                     {
                         $('pre').html(n);
                     }
                 });
              }
         });
      });   
   </script>

   // requested page(ex.sixty.php) and getFile.php should be in same directory
   // getFile.php 
    <?php
 if( isset($_POST['page']) )
 {
    echo file_get_contents($_POST['page']);
 }
    ?>
Niyati
  • 146
  • 10