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 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

Related Questions

I can use CSS or javascript but I've been struggling with it. It needs
I'm not a Javascript guru as I do more server-side work so am struggling
I'm struggling to find the right terminology here, but if you have jQuery object...
I'm struggling to get around the 404 errors from asp.net mvc beta when deploying
Have been struggling with Javascript closure for a while trying to wrap brain around
I am struggling with methods in JavaScript. obj = function(){ this.getMail = function getMail
I'm new to Javascript/Jquery and struggling with a certain issue. In the process of
I'm really bad at Javascript and I'm struggling to get my head round it.
Just struggling with a Javascript class being used as a method for some cometishian
i'm struggling with display/hide text using javascript here. Here is what i wanted to

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.