title: Save date to database in Yii Framework using Ajax
body: <p>I would like to extend the validity of a given post
  I first list all the post and besides each post, I created a button and when I click, I would like to update the existing toDate and add 1 month.</p>
  
  <p>In the following code, when the user click on the extend button,  I display the view of the post by calling the post/update action, it displays the view and the user can update manually the toDate field. How can I update the field directly from Ajax/jquery on success without having to display the update form?</p>
  
  <p>My button contains the following</p>
  
  <pre><code>&lt;p&gt;&lt;input type ="button" id = "buttonExtend" value="Extend Validity"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>and my jquery script contains the following</p>
  
  <pre><code>&lt;script&gt;
     $(document).ready(function(){                     
        $(function(){
  $("#buttonExtend.click(function(e){
              $.ajax({
                 type: "POST",
                 url: "&lt;?php echo Yii::app()-&gt;createUrl('post/update', array('id' =&gt; $data['id'])); ?&gt;",
                 success: function(data) {
                  //$("#extendValidity").html(data).fadeIn(500);
  
  
              }
             });
          });
        });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Thank you in advance for your help</p>