Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Content of certain areas (or divs) refresh on call

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
Bloodmorphed
Smarty Rookie


Joined: 20 Aug 2017
Posts: 8

PostPosted: Sun Aug 20, 2017 1:41 pm    Post subject: Content of certain areas (or divs) refresh on call Reply with quote

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
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Sun Aug 20, 2017 4:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sun Aug 20, 2017 4:48 pm    Post subject: Reply with quote

The simple answer is, if you want anything happens on client without a full page reload, you need client scripting.
Back to top
View user's profile Send private message
Bloodmorphed
Smarty Rookie


Joined: 20 Aug 2017
Posts: 8

PostPosted: Mon Aug 21, 2017 1:40 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Aug 21, 2017 9:51 am    Post subject: Reply with quote

Making subrequests with jQuery is rather simple.
But it's out of topic here.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP