Lets say you are making an ajax call on the page load:
Can you find any problem with that piece of code?
You are right! The problem is that here the ajax call is initiated only after the DOM.ready event is fired, while in fact it can be initiated before the DOM.ready, since it does not have any dependency on DOM.ready.
The only piece of code which has a dependency on DOM.ready is the one which attaches the result from the ajax call to the DOM.
Here is a better pattern, solving these problems:
As you can see, the ajax call is initiated even before the DOM.ready event and when the result arrives, then we wait till DOM.ready before modifying the DOM based on the data received.
Let me know if you have any better way of doing this.
Nice piece of work..
I am new in blogging line so just spending time researching and learning.
I like your work alot..
Hope to get ua feedback n help..thanku
Hi!
A few days I wrote to you about the possibility of producing a sponsored post. If you find interesting the possibility write me.
Hugs,
Taty
Good Work,Keep Posting
Nice point, Niyaz. Unless you are adding the loaded the content to body, you might want to make sure that the script is placed after all the selectors / elements referenced in the callback. If you add the script to head and there is a blocking content, say an ad, before the referenced element is ready, your callback might fail.
Am i allowed to recently point out what a reduction to find one of those who really is aware of what theyre discussing over the web. You certainly figure out how to get a concern to light and produce it important. The easiest way to have to have to understand this and fully grasp this specific side from account. I cannot think youre a lesser amount of popular because you absolutely offer the present.