Hello dear Django Users!
I'm trying to use django inclusion_tag or/and assignment_tag with jquery
'onclick' event.
Encountered such problems:
1. When using inclusion_tag/assignment_tag the content returned by them is
rendered on page load, not onclick.
And I suspect that it is correct behavior, once the tag is met it is
rendered by template render. So, I think that should be some way to skip
django tags? How?
2. With inclusion_tag the result returned by tag is shown in the place
where it was called, not where it is 'intended' to be.
And again, I think it is correct. But how to use inclusion_tag really
onclick event?
For example,
-------------------
<script>
$(function() {
var result = $("#select-result").empty();
$('#myid').somecontainer({animate:true,
onClick: function(node){
result.html('{% my_inclusion_tag "param1" "param2" %}');
}
});
});
</script>
-------------------
As the result(in source of loaded page) I have content returned by
inclusion_tag inside <script></script>, not under #select-result div.
Like
...
onClick: function(node){
result.html(<table>lalalala</table>);
}
...
The code that works as expected :), onclick not onload.
<script>
$(function() {
var result = $("#select-result").empty();
$('#myid').somecontainer({animate:true,
onClick: function(node){
alert(node.text);
}
});
});
</script>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/U-W3CBqvrIwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.