1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AutoInlineUploader - detect when upload has completed

Discussion in 'XenForo Development Discussions' started by Jake B., Jan 14, 2015.

  1. Jake B.

    Jake B. Well-Known Member

    I'm wanting to use the AutoInlineUploader class for a project we are working on in the AdminCP, but I need to detect when the upload is completed so I can close the modal. Is there any way we can get this done without rewriting the AutoInlineUploader javascript?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    You'll see in the code that an event is triggered in the code: "AutoInlineUploadComplete".

    Therefore:

    Code:
    $form.on('AutoInlineUploadComplete', function()
    {
        // Do something                                
    });
    That code would help you do something when that event is triggered.
     
    Jake B. likes this.
  3. Jake B.

    Jake B. Well-Known Member

    I've tried this with no luck. I'm absolutely terrible with JavaScript. How would I go about getting the $form object from outside xenforo.js?

    Edit: Nevermind, I've gotten it figured out. Works great, thanks!
     
    Last edited: Jan 14, 2015
  4. Chris D

    Chris D XenForo Developer Staff Member

    It's just the form.

    Code:
    $form = $('form.AutoInlineUploader');
    You might already have it in your code or there might be a better way but that's the basic gist.
     
  5. Jake B.

    Jake B. Well-Known Member

    Yep, I've already figured it out. Thanks Chris.
     

Share This Page