S.A Posted February 20, 2021 Share Posted February 20, 2021 Hello, everyone. Is anyone can help me? now I develop a payment method in PrestaShop. How I can send data from the .tpl file to the .js file using ajax, and how to validate input before sending it? Thank you Link to comment Share on other sites More sharing options...
pedepot Posted February 20, 2021 Share Posted February 20, 2021 You don't send any data from the TPL to the Js file. Instead, your JS file gathers data from your TPL and sends them to your server. There methods lie addjs() or registerJavascript() to include automatically JS files into your tpl. I hope it helps. Link to comment Share on other sites More sharing options...
S.A Posted February 20, 2021 Author Share Posted February 20, 2021 2 hours ago, pedepot said: You don't send any data from the TPL to the Js file. Instead, your JS file gathers data from your TPL and sends them to your server. There methods lie addjs() or registerJavascript() to include automatically JS files into your tpl. I hope it helps. Is there any tutorial help me in this point? Link to comment Share on other sites More sharing options...
pedepot Posted February 22, 2021 Share Posted February 22, 2021 There are a few modules that could demonstrate this feature within Prestashop native modules. Look at this one https://github.com/smartdatasoft/smartblog/blob/develop/controllers/admin/AdminSmartBlogAjaxController.php https://github.com/smartdatasoft/smartblog/blob/develop/views/js/tree.js https://github.com/smartdatasoft/smartblog/blob/develop/classes/SmartBlogHelperTreeCategories.php#L398 I hope it helps. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now