2

JQuery .load () Reminder

 3 years ago
source link: https://www.codesd.com/item/jquery-load-reminder.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

JQuery .load () Reminder

advertisements

I'm trying to load some content with an AJAX call and AFTER the content is loaded, perform another action. In my example, that latter action is simply an alert but in my real-world example I'm attempting to focus on an input field.

$("#box").load("/favicon.png", function(response) {
     alert('do after the load');
});

https://jsfiddle.net/u0cmmn5h/

As you can see in the fiddle, the alert fires BEFORE the favicon is actually loaded. Isn't the function supposed to fire AFTER the content has been loaded?


The callback on .load() executes upon an http response, not when the image is rendered client side.

Related Articles

How to disable autocompleted jquery loading

I have many pages and many content with jqgrid i give jquery loading in my pages but, i want jquery loading not show in input autocomplete this my screenshot pages content with jqgrid and this my screenshot jquery loading in input autocomplete I want

Will jQuery .load () Work on PhoneGap?

I know that the jQuery .load() function has a "problem": You can't retrieve pages that are outside of the current domain, because of the Same Origin Policy, but I remember when I was developing another program that I could do cross-domain AJAX w

Do not use $ _GET in the jQuery.load file

I'm making a teamchat with the help of jQuery and PHP (and I'm new to jQuery btw) and have almost succeeded, except for one thing. I have 4 files. teams.php (which would have the $_GET-info) teamchat.js (The jQuery-file which loads messages and updat

How to embed a file in html using jquery.load () in chrome

I am trying to load a txt file using jquery in Chrome. Why it does not work? I have copied this code snippet from w3schools, and all i have changed is their url. <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.c

Does jQuery .load append instead of replace?

I have a WordPress install and I'm trying to use jQuery to create a Load More effect. I'm having some trouble using the basic .load feature for page fragments. I don't mind using .get as I saw some threads here regarding that as a better solution. He

JQuery .load () with relative path - XMLHttpRequest can not load - Workaround?

I have a locally-stored project whose directory structure is the following (I minimized non-relevant folders): What I want to do is that in an HTML file, like index.html, to add a <header> such that its contents would be loaded from an external HTML

JQuery Load, stop yourself from not happening twice?

I am using jquery load to load php pages into my content area. I have noticed some screwy behavior if the user repeatedly clicks on the navigation menu items abusively. Right now my code is as simple as hiding the content pane, loading the new page,

Using jQuery Load to get part of the page

All, I'm using Wordpress so I know the main content falls within the following div: <div id="content" role="main"> I'm trying to use the jQuery load function to display only the content in between those tags. How can I say the id

Replace & lt; A href = & ldquo; & Rdquo; & Gt; When you use jquery .load to get content

Ive got a few pages, all with different content, the pages are all linked in the nav using relative path tags. What id like to do from a usability point of view is use jquery .load to get the content from the other pages and load it into the main ind

Loop to jquery load and wait until

I want to make a script that implement jquery to process php script that need a lot of execution time, so I split the process with jquery callback variable to process partially but i don't know how to implement it. need help! $("button").click(f

List multiple copies of jQuery loaded into a page

I need to embed a pice of JavaScript code into a 3rd party web site. The web site has multiple copies of jQuery loaded statically and possibly dynamically. There is also a copy of jQuery UI loaded at some moment into the web site and only one of jQue

Scripts stop working for loaded form - jquery load ajax

i am using drupal and ihve successfuly loaded a node creation form using jquery load function <div id='test'></div> <a href='#' id='test2'>test</a> so when clicking link it will load form var ajax_load = "loading..."; var

Show the jQuery loading progress before the fully loaded page

I am using requireJS domReady plug in to show jQuery loading progress on asp.net web page. Here is the code that I am using, require(['domReady'], function (domReady) { domReady(function () { //Hide jQuery loading progress }); //Show jQuery loading p

HTML jQuery .load () does not work

I am trying to use the jQuery .load() function in a bootstap html but I can't get it to work. I'd like to import some parts saved in another HTML (accueil.html) in a tab-content (#accueil). Please find below my index code & the accueil.html that I'd

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK