I'm trying to make a function in jquery which checks if a given date is a holiday according to my database. I have created the function: 

```
IsAHoliday(date)

```

Here is my code:

```
function IsAHoliday(date) {
    var datum = moment(date).format('YYYY-MM-DD');
    var dataString = 'action='+ datum;
    $.ajax ({
        type: "POST",
        url: 'include/datumPraznik.php',
        cache: false,
        async: false,
        data: dataString,
        success: function(r)
        {
            return r;
        } 
    });
}

```

With this code i can't execute something like

```
if(IsAHoliday(date)) {

```

How could i achieve this ?

---

EDIT: Here is my datumPraznik.php

```html
<?php
    include_once('db-config.php');

    $datum = $_REQUEST['action'];
    $stmt=$db_con->prepare('SELECT * FROM praznici WHERE praznik_datum=:datum');
    $stmt->execute(array(':datum'=>$datum));
    $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
    if(count($row)>0)
    {
        $praznik = true;
    }
    else
    {
        $praznik = false;
    }
    echo $praznik;
?>

```