Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% block jquery %}
- $("#po-like").click(function(event){
- event.preventDefault();
- $.ajax({
- url: $("#po-like-href").attr('href'),
- success: function(){
- },
- error: function(response, error){
- }
- })
- });
- {% endblock %}
- {% for post in tape %}
- ...
- {{ post.text }}
- ...
- <a id="po-like-href" href="/like_post/{{ post.id }}/">
- <img id="po-like" src="{% static "" %}"/>
- </a>
- {% endfor %}
- {% block jquery %}
- $(".po-like").click(function(event){
- //changing #id to .class
- //added the below line
- var img = $(this);
- event.preventDefault();
- $.ajax({
- url: img.parent().attr('href'),
- success: function(){
- },
- error: function(response, error){
- }
- })
- });
- {% endblock %}
- {% for post in tape %}
- ...
- {{ post.text }}
- ...
- //changing #id to .class
- <a class="po-like-href" href="/like_post/{{ post.id }}/">
- <img class="po-like" src="{% static "" %}"/>
- </a>
- {% endfor %}
Add Comment
Please, Sign In to add comment