$.get is not working
<p>I don't know what is wrong here I tried <a href="http://www.passer-by.net/2011/09/18/how-to-set-get-cookie-via-ajax/#codesyntax_2" rel="nofollow">this link</a> to know how can I interact between php and jquery</p>

<p>here is my code but it will alert an empty box,I'm sure that it can't read the test.php but I don't know why?!</p>

<p>mytest.php</p>

<pre><code>&lt;?php
if($_GET['cookie']!='')
{
    setcookie("cookie", $_GET['cookie']);
    echo 'set cookie: ' . $_GET['cookie'];
}
else
    echo 'get cookie: ' . $_COOKIE["cookie"];

?&gt;
</code></pre>

<p>test.html:</p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;Ajax Set &amp;amp; Get Cookie&lt;/title&gt;
  &lt;script type="text/javascript" src="jquery.min.js"&gt;&lt;/script&gt; 

&lt;script type="text/javascript"&gt;

$(document).ready( function() {

        $("#setcookie").click(function() {
            if($("#cookievalue").val() != '')
                setCookie( $("#cookievalue").val() );
        });

        $("#getcookie").click(function() {
            getCookie();
        });

     });

function setCookie(value)
{

    $.get("mytest.php", { cookie: value},
        function(data){
            alert(data);
        }
    );
}

function getCookie(value)
{

    $.get("mytest.php", { },
        function(data){
            alert(data);
        }
    );
}

&lt;/script&gt; 

&lt;/head&gt;

&lt;body&gt;
&lt;div align="center"&gt;

    Cookie: &lt;input type="text" id="cookievalue" value="" /&gt;
    &lt;br /&gt;
    &lt;input type="button" id="setcookie" value="Set Cookie"  /&gt;
    &lt;input type="button" id="getcookie" value="Get Cookie"  /&gt;

&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
