Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

jQuery ajax freewall issue[Solved]

I am using jQuery freewall js in one of my project. In that project i am getting data with ajax without reloading page and here freewall js was not working properly. Freewall js working fine with page refresh, but in my case i am displaying data with ajax without reloading page. I have tried many and found following solution for this issue. May be it will help someone else. Let's see in demo how freewall js works.

Demo | Download

jQuery ajax freewall

We need to call freewall function in success of ajax call, see following example how it works.
$.ajax({
       type: "POST", 
       url: "http://www.example.com/file.php",
       data: 'post=freewallmoredata',
       success: function(response) 
       {
             var wall = new freewall("#freewallmain");
             wall.reset({
                 selector: '.freewallchildren',
                 animate: false,
                 cellW: 245,
                 gutterX: 30,
                 gutterY: 30,
                 cellH: 'auto',
                 onResize: function() {
                          wall.fitWidth();
                 } 
           });
           wall.appendBlock(response);
           wall.fitWidth();
       },
       error: function(xhr, ajaxOptions, thrownError) { 
          alert("Something going wrong!"); 
       }
 });


Please support us, Like us on Facebook.

0 comments:

Post a Comment

 

Copyright @ 2017 HKBlog.