XF 2.2 Async ajax request

fahad ashraf

Well-known member
how i can do async ajax request ??


Code:
XF.ajax(
                    'post',
                    $(e.currentTarget).attr('href'),
                    XF.proxy(this, 'actionComplete')
                    ).always(function ()
            {
                setTimeout(function ()
                {
                    t.loading = false;
                }, 100);
            });
 
You'll probably need to explain in more detail what you're trying to achieve. XF.ajax already uses async requests by default as that is the default in the native jQuery ajax method $.ajax that XF.ajax is a wrapper around.
 
You just need to pass ajax: false into the options:

JavaScript:
var options = { ajax: false };

XF.ajax(
   'post',
   $(e.currentTarget).attr('href'),
   XF.proxy(this, 'actionComplete'),
   options
).always(function ()
{
   setTimeout(function ()
   {
      t.loading = false;
   }, 100);
});
 
after applied above solution it giving error and page keep loading
 

Attachments

  • Screenshot from 2021-09-07 18-32-12.webp
    Screenshot from 2021-09-07 18-32-12.webp
    12.4 KB · Views: 18
Back
Top Bottom