PHP Classes

File: js/like.js

Recommend this page to a friend!
  Classes of Ann   Purp Project   js/like.js   Download  
File: js/like.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Purp Project
Application to manage photo albums
Author: By
Last change: Update of js/like.js
Date: 1 year ago
Size: 1,304 bytes
 

Contents

Class file image Download
$(document).ready(function(){ $(".like").bind("click", function(event) { icon=this.querySelector('i'); ////// //let type = 0; ////// // if(icon.classList.contains('fa-heart')){ // icon.setAttribute('class', 'fa fa-heart-o'); // type = 0; // }else{ // icon.setAttribute('class', 'fa fa-heart'); // type = 1; // } pic_id = this.dataset.id; //alert(pic_id); $.ajax({ url: "../php/like.php", type: "POST", dataType: "json", data: {id: pic_id}, success: function(data) { //alert("wwwwww"); if (data.status) { //alert("ya"); $("#like").html(Number(data.likes)); if(data.isLiked){ icon.setAttribute('class', 'fa fa-heart'); }else{ icon.setAttribute('class', 'fa fa-heart-o'); } } else { console.log("Error"); } } }); }); })