How to make Prototypejs onComplete fire an alert?

77 views Asked by At

I am using prototype js and scriptaculous sortable but when i do an oncomplete alert or anything, it does not work. The sortable and all the code works well but the onComplete does not work.

Here is mycode

<script>
        Event.observe(window,'load',init,false);
        function init() {
            Sortable.create('listContainer',{tag:'div',onUpdate:updateList});
        }
        function updateList(container) {
            var url = 'ajax.php';
            var params = Sortable.serialize(container.id);
            var ajax = new Ajax.Request(url,{
                method: 'post',
                parameters: params,
                onLoading: function(){$('workingMsg').show()},
                onLoaded: function(){$('workingMsg').hide()},

                                 onComplete: function(){ alert('good'); }

 });
        }
        function handleResponse(req) {
            // this function will fire after the ajax request is complete...but we have nothing to do here
        }
    </script>

Everything works perfectly when i launch the function except the fact that onComplete the alert is not sent.

How to make Prototypejs onComplete fire an alert ?

0

There are 0 answers