The lazy loading feature in Jquery seems to be malfunctioning silently without displaying any errors in the console

I have added a Jquery loader to my function that is triggered on button click.

Here is an example of the code:

function fnLoadVendorData() {

    var vendorSel = $("#ddlVendorName option:selected").text();
    var strCircle = $("#lblRole").text();
    // $('#imgLoader').show();
    if (vendorSel != "--Select Vendor--" && typeof (vendorSel) != 'undefined') {
        $.ajax({
            type: "POST",
            url: "Ipfee.aspx/GetVendorData",
            data: JSON.stringify({ "vendorName": vendorSel, "strCircle": strCircle }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: false,
            success: function (response) {                
                if (response.d != "NoDataFound") {
                    $('#imgLoader').show();
                    var getDatalist = JSON.parse(response.d);                    
                    Create_vendorDataTable(getDatalist);
                     $('#imgLoader').hide();
                } else {
                    // $('#imgLoader').hide();
                    jAlert("Data not available !!", "Information");
                    return false;
                }
                $('#imgLoader').hide();
            },
            error: function (response, textStatus, errorThrown) {
                // $('#imgLoader').hide();
                jAlert(textStatus, "Information");
            }
        });
    }
}
<img src="Images/ipload.gif" id="imgLoader" style="display: none; width: 100%; height: 100%; z-index: 9999;" />


<div class="row">
                                    <div class="col-md-4">
                                        <div class="form-group">

                                            <select name="ddlVendorName" id="ddlVendorName" class="form-control">
    <option value="--Select Vendor--">--Select Vendor--</option>
    <option value="1032">IPFEE_INDUS</option>
    <option value="1028">IPFEE_TVIPL</option>
    <option value="1033">IPFEE_ASCEND</option>
    <option value="1029">IPFEE_BIL</option>
    <option value="1031">IPFEE_GTL</option>

</select>
                                            <label>Vendor Name</label>
                                        </div>
                                    </div>
                                    <div class="col-md-3 filterButton">
                                        <div class="form-group">
                                            <button type="button" class="btn btn-danger button" id="btnFilterClick"><i class="fa fa-filter" aria-hidden="true"></i>Filter</button>
                                        </div>
                                    </div>
                                </div>

Please advise on any corrections I should make.

Answer №1

I scoured the internet and various posts on Stack Overflow, eventually discovering that setting the async call to false was preventing the gif from loading. Once I changed it to true as shown below:

async : true;

After making that adjustment, the gif loaded successfully.

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

Updating the active navbar link with JavaScript in ASP.NET Core Razor Pages

When navigating through my Razor Pages, I need to dynamically change the color of the navbar links. I attempted using JavaScript, but encountered issues with the pages getting rerendered each time, preventing me from toggling the elements. Here's wha ...

Jquery for controlling the navigation menu

I'm new to JavaScript and facing 3 challenges: 1. When I click on the parent <li>, the correct content of the child <sub> does not show up. Each category like "colors, shapes, sizes" should have corresponding child categories like "green, ...

What are the steps for reordering an array in MongoDB?

Is there a way to increase or decrease the position of an element within an array stored in a MongoDB object? I explored the <update> API in the MongoDB API, but couldn't find a direct method for this task. I am attempting to use findOneAndUpd ...

The combination of Nest, Fastify, Fastify-next, and TypeOrm is unable to locate the next() function

In my attempt to set up Nest with Fastify and Next using the fastify-next plugin, everything went smoothly until I added TypeOrm for MongoDB integration. Upon loading the AppModule, Nest throws an error indicating that the .next() function cannot be found ...

jQuery Remote Validation Rule with Custom Success Message

I have successfully implemented JQuery validation in my registration form, however I have encountered a slight issue. Currently, if an email already exists, an error message is displayed. What I would like to do is modify it so that when the email is avail ...

Vue.js is displaying the error message "Expected Object, got Array" when the length appears as undefined

I have an app where users input style codes into a field. I want to create a popup confirmation modal that displays a message with the number of style codes provided. The code I currently have is: <template> <h4>Style Number</h4> <For ...

Determine the online status of a webpage using Visual Basic in an ASP.NET application

I've been struggling to figure out how to make this work for some time now with no success. My goal is to determine if a website is available and then display its status in a label. Unfortunately, I don't have any code to share at the moment as ...

How can one effectively manage irregularly nested object/arrays within a Meteor framework?

Having difficulty finding a smart and effective method to manage nested arrays/objects with varying dimensions in nodeJS. These irregular arrays/objects can have 1, 2, 3, or more dimensions. For instance, consider these 2 different scenarios : Scenario 1 ...

What is the maximum number of data points that can be used in a Scatter plot created

I am currently facing an issue while trying to populate a Scatter plot in JavaScript with decimal values obtained from a MySQL database using PHP. The database contains around 150,000 entries, resulting in 150,000 pairs of decimal inputs for the graph. How ...

Choosing the row at the group level when all events are selected on the UI grid

When a user clicks on the select all option in the ui-grid header, all individual rows are selected as expected. However, the high-level group rows are not included in the selection, which I find to be counter-intuitive for the user. An example of this be ...

JS Function created to supply elements to React component is failing to return correctly

Trying to validate a dataset by checking for specific prefixes or suffixes in a string, and then breaking the string into <span> elements. The current function correctly identifies the relevant morphemes in the data set, but fails to return the split ...

unable to utilize the library three.js

I stumbled upon an interesting animation on Codepen that uses blocks to reconstruct a map image. The necessary JavaScript files are three.min.js and TweenMax.min.js. I copied the links from Codepen and pasted them into my HTML using <script src="">&l ...

What is the functionality behind the Image Hover jQuery plugin?

I am relatively new to using jQuery and I would like to incorporate the Image Hover plugin on my website. Specifically, I have a collection of thumbnails representing various projects on my site. What I need help with is implementing a feature where when y ...

managing json arrays within Laravel

I am currently working on a project where I am focusing on creating an ajax call and handling the data that comes back. Here is what my Ajax call looks like: $.ajax({ type: 'GET', dataType: "json", url: ****, ...

Problem with ng-switch inside ng-repeat

There is a peculiar issue that's been bothering me I have a variety of articles such as news, tweets, and videos in a list. This is how I render them: <div ng-repeat="item in items | orderBy:-timestamp track by item.id" ng-switch="item.type"> ...

Is using an interval the best method to ensure that an Ajax call has finished successfully?

I have a scenario with two input text fields and a save button. <input type="text" id="myInput" /> <input type="text" id="searchResult"/> <button id="myButton>save</button> The myInput t ...

What is the best approach to have a React page render only the specific component that has changed, rather than re

Recently, I've been facing an issue with a toggle implementation where the page always re-renders the entire content upon the first click of the toggle. Here is a snippet of how it looks: export default function Toggle({isChecked, label}: Props) { r ...

Using the Flex display property automatically adjusts the height of a button based on its

I have a main container, and within it, an <h1> heading and a <button>. I align them using justify content-between. Since the main container has a d-flex class, the button ends up having the same height as the main container. Is there a way to ...

What is the best approach to managing the JSON data extracted from a form composed of tabular div elements?

I am dealing with a form that consists of data organized in divs within a table-like layout. Each row represents a record, but when I retrieve the values using serializeArray, I'm having trouble distinguishing between each row. Below is an example of ...

Troubleshooting issue with overlapping ticks and labels on jqplot within Salesforce platform

I have been encountering an issue while incorporating jqplot into Salesforce, where the ticks and labels end up overlapping. It looks something like this: Despite my attempts to adjust everything, I haven't had any success. Even when I tried rotating ...