Question

For this particular problem i usually use preventDefault(); but in this case it doesn't work. I would be thankful if anyone helps me with this one. Here is some of my code:

            $('.place_order').live('click',function(){
                        $('#place_order_form').ajaxForm(function(){ 
                        $('#shopping_cart').slideDown(150,function(){

                        $('#shopping_cart').load('url here');

                        $('#shopping_cart').css('display','block');
                        $('#shopping_cart').css('height','290');

                        });
                        }).submit();
            }); 

It works fine after slideUp() is executed, but on first click it just loads the data without slideDown. Any help is appreciated because I am noob Jquery developer.

Was it helpful?

Solution

Try it like this :

$(document).on('click', '.place_order', function(){
    $('#place_order_form').ajaxForm(function(){ 
        $('#shopping_cart').hide().load('url here', function() {
            $(this).slideDown(150);
        });
    }).submit();
}); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top