title: Symfony 1.4 jQuery doesn't know user is logged in because of cache?
body: <p>I have an issue with image comments trough jQuery. As I figured out the action is cached  and, when jQuery calls the action, because of the cache, it doesn't know that sfGaurd user is authenticated and therefore I can't insert a comment without user_id (relation problem) </p>
  
  <p>so here is how its done :</p>
  
  <p>ROUTING :</p>
  
  <pre><code>commentimage:
    url:     /commentimage/:image_id.:sf_format
    class:   sfDoctrineRoute
    options: { model: imagecomments, type: object }
    param:   { module: profile, action: commentimage, sf_format: html }
    requirements:
      id: \d+
      sf_method: [get, post]
      sf_format: (?:html|js)
  </code></pre>
  
  <p>ACTION :</p>
  
  <pre><code>public function executeCommentimage(sfWebRequest $request)  {
  
      $imgId   = $request-&gt;getParameter('image_id');
      $commentPost = $request-&gt;getParameter('comment');
  
      $user_id = $this-&gt;getContext()-&gt;getUser()-&gt;getAttribute('user_id','','sfGuardSecurityUser');
  
      $comment = new Imagecomments();
  
  
      $comment-&gt;setComment($commentPost);
      $comment-&gt;setImageId($imgId);
      $comment-&gt;setProfileId($user_id);
      $comment-&gt;setFirmbrandId(1);
      $comment-&gt;setPublished(1);
      $comment-&gt;save();
  
      $this-&gt;setLayout(false);      
  }
  </code></pre>
  
  <p>TEMPLATE/FORM :</p>
  
  <pre><code> &lt;form name="form" id="form&lt;?php echo $photo-&gt;getId();?&gt;" method="POST"&gt;
     &lt;input type="hidden" id="image_id" name="image_id" value="&lt;?php echo $photo-&gt;getId();?&gt;" /&gt;
     &lt;input type="text" id="comment" name="comment" value="" /&gt;
     &lt;button name="submit" class="submit botunlink"&gt;KOMENTIRAJ&lt;/button&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>AND THE jQuery:</p>
  
  <pre><code>$(".submit").click(function(e){
          e.preventDefault();
          var parent = $(this).parent();
          var imageId = get_numbers(parent.attr('id'));
          var theexactForm = "#form"+imageId;
          $(theexactForm).submit(function() {
              alert($(this).serialize());
              return false;
            });
          $.ajax({
             data: $(theexactForm).serialize(),
             url: 'http://partytime.hr/commentimage/'+imageId,
             type: "POST", 
             success: function () {
                 $("#allComments"+imageId).html("");
                 $("#allComments"+imageId).load("http://partytime.hr/showimagecomments/"+imageId);
                 //alert('imageID||'+imageId+'Forma||'+theexactForm+'COMMENT:'+data);
             },
             complete: function() { 
              //$(".allComments").mCustomScrollbar();
          }
          });
           return false;
      });
  </code></pre>
  
  <p>When I am logged in and symfony cache is cleared it works, but later on it won't work, because it can't update PROFILE_ID because cache said it wasn't logged in (that's my conclusion). </p>
  
  <p>How can I fix this?</p>