jQuery get previous month from php
<p>I have made this script that get's the month and the year from calendar.php and I would like when I click the link previous month to get the previous month but also when month number reach 1 make the year - 1. How can I do something like that? </p>

<pre><code>&lt;html&gt;
&lt;head&gt;&lt;/head&gt;


&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"    type="text/javascript"&gt;&lt;/script&gt;
&lt;script&gt;
$(function() {
get_data();
});

function get_data(a, b) {

$.get('calendar.php', { 
    month: a, year: b
    }, 

    function(response) {
    $el = $('&lt;div&gt;&lt;/div&gt;').attr('class', 'data').html(response);
    $('#datas').prepend($el);
    height = $el.height()+'px';
    $el.css({'opacity': 0, 'display': 'block', 'height': '0px'}).animate({height: height }, 500, function() {
            $(this).animate({opacity: 1}, 500);
    })
});
}
   &lt;/script&gt;
&lt;style&gt;
#datas {
overflow: hidden;
}
.data {
display: none;
}
&lt;/style&gt;
&lt;body&gt;
 &lt;a href="#" OnClick="get_data(9, 2012);" &gt; Previous month&lt;/a&gt;
&lt;div id="datas"&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
