jQWidgets Forums

jQuery UI Widgets Forums General Discussions Navigation Tabs filtering or searching in tabs

This topic contains 0 replies, has 1 voice, and was last updated by  shaliapin777 11 years, 6 months ago.

Viewing 1 post (of 1 total)
  • Author
  • filtering or searching in tabs #49575

    shaliapin777
    Participant

    HI!!!
    can anyone help me…!!!

    I have created 3 tabs

    
    <div id='jqxTabs'>
          <ul>
               <li style="margin-left: 30px;">tab1</li>
               <li>tab2</li>
               <li>tab3</li>
          </ul>
          <div id="content1" style="margin-top:10px; margin-left:10px;"></div>
          <div id="content2" style="margin-top:10px; margin-left:10px;"></div>
          <div id="content3" style="margin-top:10px; margin-left:10px;"></div>
    </div>

    and loading content from other page

    
    $('#jqxTabs').jqxTabs({ width: 836, height: '100%', theme: 'metro', animationType: 'fade'});
    	var loadPage = function (url, tabIndex) {
    	$.get(url, function (data) {
    		$('#content' + tabIndex).html(data);
    	});
    }
    	
    loadPage('ajax1.php', 1);
    $('#jqxTabs').on('selected', function (event) {
    	var pageIndex = event.args.item + 1;
    	loadPage('ajax' + pageIndex + '.php', pageIndex);
    });
    

    and in ajax1.php I have created 1 div and downloading info in this div from mysql

    
    $query	= $db->prepare('SELECT A.id as aqciaid,
    									A.name as aqcianame,
    									A.image as aqciaimage,
    									C.name as companyname
    								from aqciebi as A
    								inner join company as C on A.cid = C.id');
    		if($query->execute())
    		{
    			while ($row = $query->fetch(PDO::FETCH_ASSOC))
    			{
    				echo '<a href="index.php?lang='.$langname.'&page=company&company='.$row['companyname'].'"><div  class="aqcia" id="'.$row['aqciaid'].'" style=" background:url(./img/gallery/'.$row['aqciaimage'].');"><div class="tavze"><span class="satauri">'.$row['aqcianame'].'</span></div></div></a>';
    			}					
    		}
    		else
    		{
    			die ('error');
    		}
    

    this is working fine…

    now I add 1 form on home.php

    
    <form id="search" name="search" method="post" action="home.php" autocomplete="off">
    			<input type="text" name='srch' id="srchbox" placeholder="<?php echo pageinfo("search", $trans); ?>">
    			<button type="submit" name="srchbtn" id="srchbtn">
    				<img src="img/site/lupa.png">
    			</button>
    		</form>
    

    as you see I`m sending tis form to home.php

    now as I wnat that search info must be written on addressbar
    I wrote this code on the top of the page

    
    <?php
    if(isset($_POST['srch']) && !empty($_POST['srch']))
    {
    	header('location: index.php?lang='.$langname.'&page=home&search='.$_POST['srch']);
    }?>
    

    now I`m getting this link
    index.php?lang=en&page=home&search=abc

    so I need now to filter the DIV elements in my tabs…

    can anyone help me???

    I tryed this code

    
    <?php
    if(isset($_GET['search']))
    	{
    		echo'
    			<script type="text/javascript">
    				dataString = "search=" + '.json_encode($_GET['search']).';
    				$.ajax({
    					type: "POST",
    					url: "ajax1.php",
    					data: dataString,
    					dataType: "html",
    					cache: false,
    					error: function(){
    						alert("მოხდა შეცდომა");},
    					success: function(){
    						loadPage("ajax1.php", 1);
    					}													   
    				});	
    				$.ajax({
    					type: "POST",
    					url: "ajax2.php",
    					data: dataString,
    					dataType: "html",
    					cache: false,
    					error: function(){
    						alert("მოხდა შეცდომა");},
    					success: function(){
    						loadPage("ajax2.php", 2);
    					}													   
    				});	
    				$.ajax({
    					type: "POST",
    					url: "ajax3.php",
    					data: dataString,
    					dataType: "html",
    					cache: false,
    					error: function(){
    						alert("მოხდა შეცდომა");},
    					success: function(){
    						loadPage("ajax3.php", 3);
    					}													   
    				});
    			</script>
    		
    		';
    	}
    ?>
    

    and in ajax1.php

    
    <?php
    if (isset($_POST['search']) && !empty($_POST['search']))
    	{
    		$keyword = "%".$_POST['search']."%";
    		$query = $db->prepare('SELECT C.name as companyname,
    								C.id as companyid,
    								C.logo as companyimage
    								from company as C
    								where C.tags LIKE ?');
    		$query->bindValue(1, $keyword, PDO::PARAM_STR);
    		try
    		{
    			if($query->execute())
    			{					
    				while ($row = $query->fetch(PDO::FETCH_ASSOC))
    				{
    					echo '<div name="'.$row['companyname'].'" class="aqcia" id="'.$row['aqciaid'].'" style=" background:url(./img/gallery/'.$row['aqciaimage'].');"><div class="tavze"><span class="satauri">'.$row['aqcianame'].'</span></div></div>';
    				}
    			}
    ?>
    

    but nothing happened…

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.