0

Cakephp で ajax リクエストを実行しようとしています。
私の提出物は#enviarです。私の行動はpages/contato.

これは私のajaxリクエストです:

$(document).ready(function() {
    $('#enviar').click(function(){
        $.ajax({
            type: 'post',
        url:"<?php echo Router::url(array('controller' => 'pages','action' => 'contato')); ?>",
        })
    })
});

$.ajax をシンプルに変更し、alert()送信をクリックするとこれが機能します。
私の問題はどこですか?

4

3 に答える 3

1

あなたのajax関数で、URLをより良く変更してください:-

$.ajax({
        type: 'post',
    url:"http://localhost/teste/pages/contato"
    })
于 2013-05-13T05:29:50.520 に答える
0

Html ヘルパーと絶対パスを試しましたか?

$.ajax({
    type: 'post',
    url: "<?=$this->Html->url(array('controller' => 'pages',
                                    'action' => 'contato'),
                              true);?>"
});
于 2013-05-13T16:02:47.860 に答える