Jump to content

assign JS value to smarty


cikcak

Recommended Posts

Hey,

{foreach $custdata as $item}
    <tr class="data-item" id="{$item.gafid}">
            <td>
                <button class="btn" id="{$item.gafid}"> <- it helps me to collect ID
                    <span class="glyphicon glyphicon-pencil"></span>  Edit
                </button>
            </td>
            <td id="gafid">{$item.name}</td>
    </tr>
    {/foreach}

So I print array to table and every row has a button: Edit. On button click jquery show div. In this DIV I need get more information from array. But I can`t , I dont know clicked button ID.

id="{$item.gafid}" - this help me to get ID with jquery:
$('.btn').click(function() {
            selectedid= $(this).attr("id"); <- I got selected ID
            $('.form').css('display','');
        });

So I have correct clicked button ID. But how to assign that value in smarty? To do other things... Only one way to POST it with ajax?

 

If yes, how to do it correct to my AdminCustController.php ? I dont have module, only created a new AdminCustController , in admin themes - Cust/cust.tpl.

 

So how to correct POST variables from .js to AdminCustController? Or how to assign js values to smarty variables?

 

Appreciate of any help and advice!

 

  • Like 1
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
×
×
  • Create New...