JQUERY - .html() can also view php
<p>The following script sends data with ajax for login</p>

<p>I want to format the data returned by using, in essence, a session variable ($ _SESSION)</p>

<p>I can do it</p>

<pre><code> $("#login").click(function(){

username=$("#user_name").val();
password=$("#password").val();
 $.ajax({
    type: "POST",
    url: "inc/login.inc.php",
    data: "username="+username+"&amp;password="+password,
    success: function(msg){
      if(msg!='false')
      {
        $("#login_form").fadeOut("normal");
        $("#shadow").fadeOut();
        $("#profile").html("&lt;\?php print(\"$_SESSION['name'].\" &lt;a href='inc\/logout.inc.php' id='logout'&gt;Logout k2&lt;\/a&gt;\");\?&gt;");
        //valori menù
        if(tipo=='1')
        {$("#admin").css('display','none')}

      }
      else
      {
            $("#add_err").html("Username o password errata");
      }
    },
    beforeSend:function()
    {
         $("#add_err").html("&lt;img hspace='84' src='img/loading.gif' alt='Loading...'  width='32' height='32'&gt;" )
    }
});
 return false;
</code></pre>

<p>});</p>

<p>especially this is possible, in this way would print the name of the user just logged. otherwise I would not know how to do</p>

<pre><code>$("#profile").html("&lt;\?php print(\"$_SESSION['name'].\" &lt;a href='inc\/logout.inc.php' id='logout'&gt;Logout k2&lt;\/a&gt;\");\?&gt;");
</code></pre>
