Reload a javascript using jquery -
i have made php file shows session meter joomla's frontend using javascript. have made other php file shows user's details , reloads using jquery. want is, when press jquery's reload button, javascript session meter reload too.
session meter php:
<?php // no direct access defined('_jexec') or die('restricted access'); $document = & jfactory::getdocument(); $document->addstylesheet('***/***/session_meter.css'); include('***/***/scripts.php'); $document->addscriptdeclaration($javascript); $output = array(); $session = & jfactory::getsession(); $expire = $session->getexpire(); $output[] = '<span id="log_res" class="">'.$expire.'</span>'; foreach ($output $item){echo $item;} ?>
session meter javascript (part of it):
<?php // no direct access defined('_jexec') or die('restricted access'); $javascript = ' var timer_start =$time(); '."\n"; $javascript .= 'blah blah blah... ?>
user profile jquery script (part of it):
<?php // no direct access defined('_jexec') or die('restricted access'); ?> <script> var $jq_ = jquery.noconflict(); $jq_(document).ready(function(){ $jq_("#refresh_button").click(function(){$jq_("#r_points").load('index.php #r_points').fadeout(1000).fadein(1000);}); }); </script>
i trying this:
$jq_("#refresh_button").click(function(){ $jq_("#log_res").load('index.php #log_res').fadeout(1000).fadein(1000); });
but reloads session meter's span
, not javascript!
any idea?
i don't know can done php...but things can are:
- save in local storage (the progress)
- put reloading part in iframe parent doesn't load again
- wrap js meter part function , call @ top/onload event, when page reloads gets called too.
- use
eval
call javascript in string form
Comments
Post a Comment