What are the top strategies for loading models on a webpage in AJAX systems?

As we delve into the world of using ExtJS with .NET web services to create ajax applications, a question arises regarding best practices for retrieving the model on the client side. An example scenario is having a form with 10 comboboxes. Should each combobox be loaded individually through separate ajax calls, or should a single web service call return the "model" containing all 10 lists for the dropdowns? How are others approaching this issue?

In the case of individual web services, one potential advantage is reduced payload size and the ability to leverage the multiple threads available within the browser (typically 2-4). Increased concurrency can even be achieved by using different domain names for each request. This approach allows for concurrent fetching of the model. What do you think about this strategy?

Answer №1

Should I opt for making multiple individual ajax calls, each loading a corresponding combobox as the results come in? Or is it better to make just one web service call that provides the "model" for all 10 lists needed for each dropdown?

Creating a new web service that fetches the model for all 10 lists, along with any additional data required, would be more efficient. It's easier on the server to handle one request than multiple requests, especially when dealing with a large number of users accessing the form. With 100 users simultaneously loading the form, using a single request could save the server from processing over 1,100 requests (counting initial page load and subsequent AJAX calls).

Your web service can easily return a structure like this example for ExtJS:

{
    chk1: true,
    chk2: false,
    chk3: true...
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to retrieve data from two separate calls to MongoDB and then pass it to a child component?

I am developing an application where users can save their favorite rental assets and view them on a page called favorites. class Favorites extends Component { state = { cards: [], }; async componentDidMount() { const { data } = await u ...

The transition effect of changing opacity from 0 to 1 is not functioning properly in Firefox

Having some trouble with this animation not working in Firefox. I'm triggering the animation using JavaScript after a delay like so: document.getElementById('my_id').style.webkitAnimationPlayState = "running"; I've also attempted: s ...

Choosing a single item from multiple elements in React using React and typescript

In this particular project, React, TypeScript, and ant design have been utilized. Within a specific section of the project, only one box out of three options should be selected. Despite implementing useState and toggle functionalities, all boxes end up bei ...

Tips for executing forEach on a promise?

I am currently working with a function that returns a promise of an array: async function functionReturningPromiseOfUserIDs(): Promise<string[]> My question is, can I use the forEach method on the array returned by this function? async function runF ...

Issue with Yup and Formik not validating checkboxes as expected

I'm struggling to figure out why the validation isn't functioning as expected: export default function Check() { const label = { inputProps: { "aria-label": "termsOfService" } }; const formSchema = yup.object().shape({ ...

Arranging null values and numbers to imitate the behavior of the tabindex HTML attribute

Currently, I am facing a rather unusual issue with JavaScript sorting. As I delved into the complex world of sorting, I found myself in need of some guidance: My goal is to replicate the functionality of the tabindex HTML attribute, which alters the order ...

Is there a way in javascript, jquery, and plupload to dynamically pass a parameter to the URL without needing to reload the page or object?

I've recently taken over a project that utilizes plupload. I am encountering an issue where I need to change the URL of the object after it has been loaded. However, I'm unsure if this is possible and what steps I would need to take to achieve th ...

An error was encountered: object does not possess the function 'tooltip'

I have been attempting to display a tooltip on a textbox using jQuery scripts within a web form that utilizes a Master Page. While everything appears to be working fine when I run my code, I am encountering the above error in the resources folder of the DO ...

Break down a data structure into a type that includes multiple options

Is it possible for Typescript to support type or interface "destructuring" (if that's the right term)? I am attempting to achieve something similar to the code snippet below: type SomeRandomType = { propertyOne: string; propertyTwo: number; ...

Using Angular to open a modal by invoking the href function

Current Project Context I am currently following a tutorial on CRUD operations with DataTables, but I am using Asp.Net WebApi with Angular for this project. At step 9 of the tutorial, it introduces partial views for pop-up windows. However, instead of us ...

Identifying and Blocking Users from Accessing External Domains Outside of the Angular Application

I am working on an angular application and I need to implement a feature where I can detect when a user navigates outside of the app domain from a specific component. For instance, let's say the user is on the upload component processing important in ...

Listen to music on an Android device without disturbing anyone using an iPhone

I have an application built in Vue3 that plays a sound when a QR code is scanned. This feature works perfectly on Android and the web, but not when using the browser on iOS. I am struggling to identify the issue. Can anyone provide some insight? <qrco ...

Is it possible for me to make the default export anonymous?

Why bother naming the export if you already have a file with the default export name? This seems redundant and goes against the DRY principle. While there is a rule that discourages anonymous default exports, how can we enforce an error when someone does ...

jQuery not refreshing properly

I'm currently in the process of creating a script to switch the language on a website using PHP and Ajax/jQuery. I would like the page content to refresh without having to reload the entire page. So far, this is what I have come up with: $( "a[data-r ...

Modifying the HTML content of a span element does not always initialize all of its properties

I've been working on setting up a comments-reply system for my website. I have all the necessary PHP files in place, but I'm facing an issue with updating the vote counts dynamically. In the image provided, you can see that upon voting once, I a ...

Error Message: Unable to Modify Headers Once Sent - NodeJS

I encountered an issue with my node.js app where one of the routes keeps throwing a "Can't set headers after they are sent error". Description of the route: In my application, users have different access levels. This specific route checks the user&a ...

Issue encountered while requesting data from API in ReactJS

I've been trying to fetch data from using the react useEffect hook. However, instead of displaying the data, I keep getting an error message that says, "Error: Objects are not valid as a React child (found: object with keys {number, name}). If you me ...

Which approach is more impactful: consistently sending an ajax request or breaking down the result within a function?

My JSON data consists of news entries with titles, text, and dates. Here is an example: { "news": [ {"title": "some title #1","text": "text","date": "27.12.15 23:45"}, {"title": "some title #2","text": "text","date": "26.12.15 22:35"}, ... ...

"Vue allows developers to define components by providing both template and script through the Vue()

I'm currently facing an issue while setting up a component within my global Vue() initialization. Surprisingly, I've managed to define the template for the component, but I'm struggling to specify the actual class that is executing the opera ...

How to mimic a mouse hover effect with JavaScript

I'm attempting to replicate a mouse hover effect using JavaScript. Here is the code I have: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <style> #chart:hover { ...