I've been trying to figure out why the queries on liked_button.php are entering twice for about 24 hrs now with no luck.

I have a liked button that users can click, when that button is clicked, info goes to liked_button.php, that info is subsequently transferred to the `likes` and `notifications` table. But for some reason, the query runs twice.

Here is the relevant code:

My echoed like form with like button on index.php
<form name='likes_form' id='likes_form' action='liked_button.php'>

                                          <input type='hidden' name='hidden_folder' class='hidden_folder' value='$random_directory'>

                                          <input type='hidden' name='hidden_name' class='hidden_name' value='$image_name'>

                                          <input type='hidden' name='hidden_image' class='hidden_image' value='$image_info'>

                                          <input type='hidden' name='hidden_user' class='hidden_user' value='$posted_by'>

                                          <input type='image' id='like_button' class='like_button button' src='$button_source' onClick='return getLikes ()'>

                                          <input disabled class='total_likes' value='$liked_count'>

The JS function that clicking the like button calls:

function getLikes()  {//function to leave_comment.php
  var form = jQuery("#likes_form");
        $.ajax({ type: "GET", url: form.attr("action"), data: form.serialize(), success: function() {/**/} });


The liked_button.php page:

error_reporting(E_ALL); ini_set('display_errors', 1); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);


    if(!isset($_SESSION['id']))	{



		$full_location = $_GET['hidden_image'];
		$ghost_folder = $_GET['hidden_folder'];
		$ghost_name = $_GET['hidden_name'];

		$uploading_user = $_GET['hidden_user'];

		$liker = $_SESSION['id'];

		$date = date('M/d/Y');
		$time = date('Y:m:d h:i:s');

		$action = 'liked';

		$status = '0';

		$conn = mysqli_connect("localhost","root","") or die ("No SQLI");
				mysqli_select_db($conn, "sample") or die ("No DB");

		$enter_likes = ("INSERT INTO `likes` (action, hidden_folder, hidden_name, liked_img_loc, liked_by, posted_by, liked_unliked, date, time, status) VALUES ('$action','$ghost_folder','$ghost_name','$full_location','$liker','$uploading_user','1','$date','$time','$status')");

		mysqli_query($conn, $enter_likes) or die ("No query");


		$likes_notifications = ("INSERT INTO `notifications` (action, loc_of_img, causing_user, effected_user, time, date) VALUES ('$action','$full_location','$liker','$uploading_user','$time','$date')");

		mysqli_query($conn, $likes_notifications) or die ("No notifications query");



I've ran
on all variables on liked_button.php and all the variables contain the correct info.

For the life of me I just can't figure out why the queries are running twice.

I have the same sort of setup to get user comments and store them into `comments` and `notifications` and that setup works just fine. Any help is appreciated!