So first off, I'm new with jQuery and Ajax. I'm curious to learn more and decided to make a project for myself that is based on Ajax/PHP/jQuery/JavaScript and so on... I want to combine all languages. Now i ran into an problem wich is:
The code of my JavaScript, this call's the PHP file:
function fetchDatabase(method, value) {
    document.getElementById("database_result").innerHTML = '<p class="loading">Laden...</p>';
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    } else {
        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("database_result").innerHTML = xmlhttp.responseText;
        }
    }
    if (value != 'none') {
        xmlhttp.open(method, 'php/fetch_browse.php?value=' + value);
    } else {
        xmlhttp.open(method, 'php/fetch_browse.php');
    }
    xmlhttp.send();
}
Now here is my PHP file, this fetches data out of my database:
<?php 
include('database.php');
if (isset($_GET['value'])) {
    $value = $mysqli->real_escape_string($_GET['value']);
    $filequery = "SELECT * FROM files WHERE filelocation='".$value."'";
    $folderquery = "SELECT * FROM folders WHERE folderlocation='".$value."'";
} else {
    $filequery = "SELECT * FROM files";
    $folderquery = "SELECT * FROM folders";
}
foreach ($mysqli->query($folderquery) as $row) {
    echo '<a class="browseclick">';
    echo '<div class="browse-item">';
    echo '<img src="img/browse-item/folder.png">';
    echo '<p title="' . $row['foldername'] . '">' . $row['foldername'] . '</p>';
    echo '</div>';
    echo '</a>';
}
foreach ($mysqli->query($filequery) as $row) {
    echo '<a class="browseclick">';
    echo '<div class="browse-item">';
    echo '<img src="img/browse-item/' . $row['filetype'] . '.png">';
    echo '<p title="' . $row['file'] . '">' . $row['file'] . '</p>';
    echo '</div>';
    echo '</a>';
}
mysqli_close($mysqli);
?>
As you can see, in my PHP code the <a>'s have a class: ".browseclick" 
I want with jQuery if i click this i can execute a function.
So my jQuery code is:
$('.browseclick').click(function() {
    var test = $(this).text() + ' - < This is a test';
    console.log(test);
});
But it doesn't console.log() anything. not even the '< This is a test'.
So I tried to put script tags with an alert in the PHP file it self. Also this won't work.
Anyone an idea how i CAN execute javascript with content my ajax has fetched?
Thanks,
 
    