Call ajax from html code

Hello, I have made a custom module very simple (I have ommited parts of the code).

I want to use the onClick event of an <a> html element to call a javascript function that uses ajax to call a php script that makes an update to the database. The problem is that the ajax function ALWAYS return ERROR but if I call the function with the browse console it works and If I enter directly by the url to the php script it works also. Which is the problem? Can anyone help me?

down.info

name = Down                                                                         
description = Downloads module
core = 7.x 
package = My Modules
files[] = down.module

down.module

function down_menu() {
    $items = array();
    $items['down'] = array(
        'title' => 'Downloads',                                     
        'page callback' => 'show_downloads',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );       
    return $items;
} 

function show_downloads() {

$page.="<script type="text/javascript">";
    $page.="function increase_download_counter(release) {";
    $page.="console.log("enter");";
    $page.="jQuery.ajax({";
    $page.="type: "POST",";
    $page.=" url: "./scripts.php",";
    $page.="data: 'release='+release,";
    $page.="success: function(response) { console.log("SUCCESS: "); console.log(response); },";
    $page.="error: function(response) { console.log("ERROR: "); console.log(response);}";
    $page.="});";
    $page.="}";
       
    $page.="</script>";

$page.="<a class='downloadButton' onClick='increase_download_counter(1);'>";

    return $page;
}
Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed