Jump to content

Javascript to smarty


R.Kinkeris
 Share

Recommended Posts

Hello,
I'm trying to make pagination with input field.
For example: someone types a value in input field and when I press GO the value is passed to smarty so I can use the function

{$link->goPage($requestPage, $page)}

ere $page is the value in the input field. The thing is that I only know how to get the value of input field with javascript and I don't know how to pass it further to smarty so I can use it. Anyone has any ideas?

Thanks in advance.

Share this post


Link to post
Share on other sites

You can't do that directly, as Javascript is run on the client (i.e. browser) side, and php/smarty on the server side. Smarty's job is done (i.e. the page to show in the browser is created) before the javascript's job starts. You have to send the page value back to the server first, so that they can do something with it.

 

Read more about it in this link:

http://stackoverflow.com/questions/1271026/how-to-assign-a-javascript-variable-to-a-smarty-variable

 

My 2 cents,

pascal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More