views:

30

answers:

1
<script>
function compare(profile_id)
{
{% ifequal '{{profile.id}}'  %}
  selected_sub='selected';
{% endifequal %}
}
</script>

How to compare {{profile.id}} and javascript variable profile_id

+2  A: 
function compare(profile_id){
    if (profile_id == {{ profilegroup.subject.id }})
        \\ do something
}

Keep in mind, that the script must be in a template, not in some served statically file with scripts (it must be filled with values, to work). Remember also, that you simply have templated script, that gets filled, when the response is generated and it will have exactly one value (for the profilegroup passed to the template).

gruszczy