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

  • Home
  • SEARCH
  • 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 507643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:49:32+00:00 2026-05-13T06:49:32+00:00

I am struggling with Javascript. Most of my problems do not arise from lack

  • 0

I am struggling with Javascript. Most of my problems do not arise from lack of understanding of the language (well, that as well, but bear with me). Instead, the main issue is to understand what is good programming/code organization style.

For example, I need to have different entities (forms, text areas, tables, etc.) around in a page, and have them modified according to events, either user triggered or Ajax.

My first idea was to define one class for each entity, define methods on the prototype of these classes, then instantiate the classes binding them to specific HTML ids (either implicitly or when instantiated with new), and register handlers between events and method calls. In other words, kind of “QT-style”. I soon realized that it’s not trivial. You cannot register object methods directly as callbacks, you have to wrap them in a closure, etc…

Another idea I had was to declare just a bunch of callback functions, no objects, and each callback operates on global variables and on the DOM. Quick and dirty, no fuss. It’s like your page is just a big object whose events are handled internally.

Every solution I could think of left me with the sensation that I was drastically misusing the tool. In the end, I don’t feel comfortable because I saw very few javascript code in my programming experience, and it’s very different from all the languages I have experience with. Peeking into the first stuff I download it’s guaranteed to be a waste of time, as it is compressed and/or obfuscated and/or not “up to date” with the current “good javascript practices”, so I am asking you a simple, powerful and clean web page plus its associated javascript code to get quickly into a proper programming/code layout style.

(I’m using jQuery, but my question is independent from that. Nevertheless, an example using jQuery would be preferred).

  • 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-13T06:49:32+00:00Added an answer on May 13, 2026 at 6:49 am

    I have an example of how I make JavaScript Apps in this question. The summary is:

    • Create one file for each singleton object. In your code, store ajax middle layer and ui interface in separate files
    • Create a global singleton object for the 3 layers usually in the project; GUI, Backend and App
    • Never use pure ajax from anywhere outside the Backend object. Store the URL to the serverside page in the Backend object and create one function that uses that URL to contact the server.
    • Have a JSON class on the server that can report errors and exceptions to the client. In the Backend object, check if the returned JSON object contains an error, and call the serverError function in the GUI class to present the error to the user (or developer).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 238k
  • Answers 238k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Because ["test@mail.com"] evaluates to an ArrayList, not an array: groovy:000>… May 13, 2026 at 6:50 am
  • Editorial Team
    Editorial Team added an answer There really are no good answers. I'd be very surprised… May 13, 2026 at 6:49 am
  • Editorial Team
    Editorial Team added an answer I don't know if this is gonna work but try:… May 13, 2026 at 6:49 am

Related Questions

The dillema is like this: If I try to fit all the scripts blocks
I am trying to learn javascript/jquery, using firebug to debug and have built a
I am currently investigating replacing the tabs provided by a Struts 1 tag library
I need to call a Javascript function from an a element.. something like this:
I know that Google does some open source but a lot of their assets

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.