Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 658061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:53:31+00:00 2026-05-13T22:53:31+00:00

I am currently using Valums JQuery File Upload plugin. The plugin is very convenient

  • 0

I am currently using Valums JQuery File Upload plugin. The plugin is very convenient to use, but I do not like how the code looks. Because it occupied inside document.ready such as:

$(document).ready(function() {
    var button = $('#button1'), interval;

    new AjaxUpload(button, {
        action: 'http://test.com/user/uploadfile', 
        name: 'myfile',
        onSubmit : function(file, ext){
            // change button text, when user selects file           
            button.text('Uploading');

            // If you want to allow uploading only 1 file at time,
            // you can disable upload button
            this.disable();

            // Uploding -> Uploading. -> Uploading...
            interval = window.setInterval(function(){
                var text = button.text();
                if (text.length < 13){
                    button.text(text + '.');                    
                } else {
                    button.text('Uploading');               
                }
            }, 200);
        },
        onComplete: function(file, response){
            button.text('Upload Finished');

            window.clearInterval(interval);

            // enable upload button
            //this.enable();

            alert(response);            
        }
    });
});

My question is can the code be more simplified? So that I can have the code more or less look like :

$(document).ready(function() {
    var button = $('#button1'), interval;

    new AjaxUpload(button, {#leads to another function}#);
});

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:53:32+00:00Added an answer on May 13, 2026 at 10:53 pm

    Are you new to Javascript? I remember my first experiences with Javascript & jQuery were interesting because I didn’t like the way my code looked at first. The thing is that you really have to get used to it and understand that it is all there for a reason. Writing a custom plugin to do things like this would work, but in the end, you’ll still have that code stashed away somewhere. Just pick a code nesting scheme you like and be proud of what you have working because 99% of your guests prolly won’t really care =)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use wordpress' built-in ajax to process an upload using the AjaxUpload
I am using Eric Martin's SimpleModal plugin 1.4.1 with JQuery 1.4.2 to display basic
Currently I am using java servlets to set up Hashmaps, lists, and range of
I'm using jQuery to get a few values and them i send to an
I'm using jQuery slider for making range sliders. By moving the sliders the corresponding
I am using a jQuery calendar to display events, which is designed to pull
I have a search field, and I need a clear button. I currently have
I have an application(developed in python) that requires a refreshed view from the datastore
I'm trying to create a simple login system that will have the forms and
I am passing 3 HashMaps that contain data pertaining to 13 different time periods,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.