Ajax有时适用于post,有时适用于get

I know this may look strange but it happened to me many times. I'm building a website, and everytime I use ajax, i choose POST as method, and to call datas in php file I use $_POST. At first it works... but after a few days, all scripts using ajax don't work anymore, then I tried to remplace $_POST to $_GET, but ajax method is still always POST. and after some days again scripts don't work and i remplace get to post... I don't want to get these errors again so I want to know why i had to remplace those methodes in php files.

this is example of the JS code

$(".add-category").click(function(e) {
    e.preventDefault();
    var $this = $(this);
    $(".cats").append('<div class="load" style="margin:auto"><i class="fa fa-spinner fa-spin"></i></div>');
    $.ajax({
        method : "POST",
        url : $this.data("url"),
        data : {
            cat : $this.prev().val()
        },
            success : function(data){
        $('.load').remove();
        $(".cats").append(data);
        }
    });
});

and this is its php file

<?php
require_once "../../core/Database.php";
require_once "../../core/functions.php";
Database::connect();

if(isset($_GET["cat"]) && strlen($_GET["cat"]) > 0 ){
    Database::query("INSERT INTO categories(title_category) VALUES(?)",[$_GET["cat"]]);
    $req = Database::query("SELECT * FROM categories ORDER BY id_category DESC");
    $cat = $req->fetch();
echo '
    <div class="gray cat">'.$cat->title_category.'
        <a href="" class="red add-category" data-url="'.getLink("index",["page"=>"delete-category","id"=>$cat->id_category]).'"><i class="fa fa-trash"></i></a>
    </div>
';
}

Thanks