Search code examples
jqueryajaxzend-frameworkrequestnstimeinterval

Ajax call with Time interval zend framework


What i want to do is basically to retrieve div and sub div content every 3 seconds. I am using ajax to send the data to the controller. but i am getting

$.ajax is not a function
http://localhost/index/editor
Line 25

This is the code i am using.

<script type="text/javascript">
    window.setInterval(getAjax, 3000);

    function getAjax() {
        $.ajax({
            type: "POST",
            url: 'localhost/index',
            data: "some-data"     
        });
    }

</script>

1) I am i doing something wrong

2) how to receive data in zend controller


Solution

  • $.ajax is defined by jQuery. You have to include it before calling this function.