I'm trying to load some local variables onto a page which is supposed to have different texts, depending on the user's system (or browser) language. Here is what I did so far:
A simple HTML page:
<html>
    <head>
        <title>Page title</title>
        <<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
        <link rel="stylesheet" type="text/css" href="/css/style.css">
        <script>
            $( document ).ready(function() {
                jQuery.ajax({
                    url: "login_backend.php",
                    dataType:'json',
                    success:function(response)
                    {
                        $('#loginline').html(response.first );
                        $('#passwordline').html(response.second );
                    }
                });
            });
        </script>
    </head>
<body link='#b9b5b1' vlink='#f2f0ed' alink='#908f8e'>
<table width='100%' height='100%'>
<form method='POST' action='buzz-login.php' enctype=utf-8 accept-charset=utf-8>
<tr>
<td align=center><table>
<tr>
<td><table>
<tr>
<td><div id = "loginline" class = "loginline">Test1:</div></td>
<td><input type='text' name='login' size='15'></td>
</tr>
<tr>
<td><div id = "passwordline" class = "passwordline">Test2:</div></td>
<td><input
type='password' name='password' size='15'></td>
</tr>
</table></td>
</tr>
<tr>
<td align = center><input type='submit' name='ok'
value='$login_button'></td>
</tr>
<tr>
<td align = center><font color='red'>Random msg</font></td>
</tr>
</table></td>
</tr>
</form>
</table>
</body>
</html>
login_backend.php
<?
    session_start();
    $_SESSION['locale'] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);// detecting language
    include "locale/{$_SESSION['locale']}.php";//loading locale file with proper prefix
$locale = array[ //the array is filled from variables, initiated in a particular locale file
"loginline"=>"$login_line", 
"passwordline"=>"$password_line"
];
echo json_encode($locale);
?>
And lastly we have several local files which look like the following (en.php):
<?
$login_line           = "ID";
$password_line        = "Password";
?>
The big idea was to request the local variables upon page load and place them into proper divs. I'm getting no errors, but it's not working.
 
     
     
    