|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Bloodmorphed Smarty Rookie
Joined: 20 Aug 2017 Posts: 8
|
Posted: Sun Aug 20, 2017 1:41 pm Post subject: Content of certain areas (or divs) refresh on call |
|
|
I have an issue where I want to push a button and it updates say, a lot of different information I have displayed on the page.
I have a select form I wish not to refresh and would like it to stay on which value I had it on when the button is push (also want to push a selected value where it sticks, that might be the easier approach, at least for the select form not "refreshing" it would but keep the option)
At any rate, is there a way to do this via smarty? Or will I have to use JS for this?
I tried this:
Code: | {foreach from=$mobs item=mob}
<option value="{$mob->id}" {if $mob->id == $player->lastmob}selected{/if}>{$mob->name} ({$mob->id})</option>
{/foreach} |
|
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sun Aug 20, 2017 4:05 pm Post subject: |
|
|
Definitely a javascript solution is wanted.
If the updated data is pulled from the server, then ajax queries are to be used.
jQuery may help tremendously. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Aug 20, 2017 4:48 pm Post subject: |
|
|
The simple answer is, if you want anything happens on client without a full page reload, you need client scripting. |
|
Back to top |
|
Bloodmorphed Smarty Rookie
Joined: 20 Aug 2017 Posts: 8
|
Posted: Mon Aug 21, 2017 1:40 am Post subject: |
|
|
Thats what I thought. I have jQuery installed. but I don't think I'm skilled enough to do something like that. Still have a lot to learn.
Thanks! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Aug 21, 2017 9:51 am Post subject: |
|
|
Making subrequests with jQuery is rather simple.
But it's out of topic here. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|