jquery - Pass PHP variables without using href in Bootstrap tabs -



jquery - Pass PHP variables without using href in Bootstrap tabs -

i'm trying send php variables using <a> tag , info attribute on same php page using bootstrap tabs:

html (bootstrap tab option):

<a style='padding:20px;' href='#tab_e' data-page='$page' class='passrss' data-rssid='$rssid' data-toggle='tab'>test</a>

php (stored in #tab_e tab):

$rsspassedid = $rssid tag (data-rssid)

i'd value stored in data-rssid on click , pass variable farther downwards in same php file when tab opened using #tab_e, mysql statement run based on value provided in $rssid , display results of query. i'm not sure if jquery/ajax required possible info stored in info attribute of <a> tag in php?

update

i've tried storing variables in pagination links still no luck, here's xhr object created:

<script> $(document).ready(function () { $('.passrss').click(function () { $('span.pass-tabe').load('tabe.php?rssid=' + $(this).data('rssid') + '&page=' + $(this).data('page')); }); }); </script>

tabe passes variables stored in tag seperate php file (tabe.php) loads browser using <span class="pass-tabe"></span>, pagination - links stored in tabe.php file refer main php file hence pagination fails work e.g.

originalphpfile.php?page=$page&rssid=$rssidpassed&pageurl=$x#tab_e

note: $rssidpassed stored in tabe.php gets xhr object e.g.

$_get['rssid'] update 2

i've added code pagination below i'm having issue @ moment stored in tabe.php:

$perpage = 10; $pageurl = (isset($_get['pageurl'])) ? (int)$_get['pageurl'] : 1; $start = ($pageurl - 1) * $perpage; $pagequery = mysql_query("select count('topic_id') topic cat_id='$page' , topic.users_id = '$rssid'"); $pagination = ceil(mysql_result($pagequery, 0) / $perpage); //query goes here //pagination numbers if($pagination >= 1){ echo "<div style='text-align:center;'><ul class='pagination'>"; for($x=1; $x<=$pagination; $x++){ echo ($x == $pageurl) ? "<li class='active'><a href='originalphpfile.php?page=$page&pageurl=$x#tab_e'>$x</a></li>":"<li><a href='originalphpfile.php?page=$page&pageurl=$x#tab_e'>$x</a></li>"; } echo "</ul></div>"; }

when click on pagination links, doesn't load second, third, etc set of results returns originalphpfile.php

is there work around this?

i'm going go ahead , turn reply because our comment blocks getting long.

in php template, turn php useful you're going need this:

// file1.php // notice <?= ?> quick echo, same <? echo $rssid; ?> <a style='padding:20px;' href='#tab_e' data-rssid='<?= $rssid ?>' data-toggle='tab'>test</a>

in javascript, reason you're getting $rssid because you're not echoing value, think, according post.

// file2.php $page = array_key_exists($_get,'page') && is_numeric( $_get['page'] ) ? $_get['page'] : 1 // query i.e select * x offset $page * $per_page limit $per_page // stuff pagination in loop defining index $number <a class="pagination" onclick="getpage(<?= $number ?>)"><?= $number; ?></a>

then in jquery:

// phone call when click tab var id; function setid(id){ id = id; getpage(1); } // phone call when click pagination function getpage(number){ $('span.pass-tabe').load('tabe.php?rssid=' + $id + '&page=' +number ) }

please massage illustration code, seems if you're doing complex , it's hard grasp exact utilize case precisely.

php jquery ajax twitter-bootstrap

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -