Phalcon jquery-ajax按钮点击

I am warking in phalcon framework, and i am trying to call controller's method to get simple string using jquery-ajax. When i placed my ajax call inside $(document).ready(function() ajax call worked, but when i placed same code inside $('#dugme').click(function() ajax call reported error. I am confused. Here is my view code:

<script type="text/javascript">

$(document).ready(function(){
    //alert($("#nesto").val());
    //atr = $(".klasa").attr("id");
    //alert("Id je: " + atr)

     $.ajax({
        url: '<?php echo  $this->url->get("xml/posalji");?>',
        type: 'POST',
        dataType: 'json',
        success: function(data){
            alert(data);
        },
        error: function(){
            alert("Neuspjesan JSON zahtjev!");
        }
       });


 $('#dugme').click(function(){

        $.ajax({
        url: '<?php echo  $this->url->get("xml/posalji");?>',
        type: 'POST',
        dataType: 'json',
        success: function(data){
            alert(data);
        },
        error: function(){
            alert("Neuspjesan JSON zahtjev!");
        }
       });

    }) ; 

  });



</script>

<h2>Basic example</h2>

<?php echo Tag::form("xml/pretraga"); ?>

<p>
<label for="name">Title</label>
<?php $opt = array('title', 'id'=>'nesto', 'size'=>'10');
  $buttopt = array('Show', 'id'=>'dugme','class'=>'klasa');
?>
<?php echo Tag::textField($opt) ?>
</p>
<p>
<?php echo Tag::SubmitButton($buttopt) ?>
</p>

</form>

and here is my action code:

 public function posaljiAction(){
    $this->view->disable();
    $data = "My name is Nedimo";
    echo json_encode($data);
 }

Please, can anyone tell me what is wrong in my code.