Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

как передать переменную из twig в js


Recommended Posts

находим на страниэто цикл

{% for product in products %}

 

после него в люпотому чтом месте НО перед

{% endfor %}

 

всивить

<input type="text" id="productName" name="productK" value="{{ product.name }}" />

 

А этот код в цикл не нужно, его в низ шаблона можно посивить

<script>
var product_Name = $('#productName').val();

$('.rm_notyfy').html(product_Name);
</script>

 

Link to comment
Share on other sites

2 минуты назад, Anton1988 сказал:
id="productName" именно ик потомучто product.name или это просто пример?

причем тут ваш  product.name   и игдентификатор блока???? вы оказ и с html вообещё не дружите. В этот области у вас проблемы с руками, ик почему бы не погуглить

Жесть..... после иких вопрос отвечать не хочеться. Ссылку на сайт не хотите давать, как будто его кто то скушает. 

Вы фрилансер??? Клиенту сайт гделаете?

Link to comment
Share on other sites

productName" именно ик потомучто product.name я имел ввиду что с MVC  начал недавно только может это фишка икая синиксиса а ик Спасипотому что все зарилиило когда в цикл всивил 

 

Link to comment
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

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.