diff options
Diffstat (limited to 'pyaggr3g470r/templates/home.html')
-rw-r--r-- | pyaggr3g470r/templates/home.html | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html index 3db5eb87..95fa3b44 100644 --- a/pyaggr3g470r/templates/home.html +++ b/pyaggr3g470r/templates/home.html @@ -132,63 +132,4 @@ {% endif %} </div><!-- /.container --> {% endif %} - -<script type="text/javascript" class="source"> - -$(document).ready(function() { - // Like or unlike an article - $('.like').on('click', function() { - var article_id = $(this).parent().parent().parent().attr("data-article"); - - var data; - if ($(this).hasClass("glyphicon-star")) { - data = JSON.stringify({ - like: false - }) - $(this).removeClass('glyphicon-star').addClass('glyphicon-star-empty'); - } - else { - data = JSON.stringify({ - like: true - }) - $(this).removeClass('glyphicon-star-empty').addClass('glyphicon-star'); - } - - // sends the updates to the server - $.ajax({ - type: 'PUT', - // Provide correct Content-Type, so that Flask will know how to process it. - contentType: 'application/json', - // Encode your data as JSON. - data: data, - // This is the type of data you're expecting back from the server. - url: "/api/v1.0/articles/"+article_id, - success: function (result) { - //console.log(result); - }, - error: function(XMLHttpRequest, textStatus, errorThrown){ - console.log(XMLHttpRequest.responseText); - } - }); // ajax closed - }); - - // Delete an article - $('.delete').on('click', function() { - var article_id = $(this).parent().parent().parent().attr("data-article"); - $(this).parent().parent().parent().remove(); - - // sends the updates to the server - $.ajax({ - type: 'DELETE', - url: "/api/v1.0/articles/"+article_id, - success: function (result) { - //console.log(result); - }, - error: function(XMLHttpRequest, textStatus, errorThrown){ - console.log(XMLHttpRequest.responseText); - } - }); // ajax closed - }); -}) -</script> -{% endblock %} +{% endblock %}
\ No newline at end of file |