using jQuery I’d like to load a local html file first ( which contains a spesific id element )
right after that I’d like to run a jQuery plugin to work on the spesific id element that is loaded from the external page.
But it doesn’t work as expected.
Below you can see the code piece which is not working as expected.
$("#left").load("tree.html");
$("#tree").treeview({
collapsed: false,
animated: "medium",
persist: "location"
});
**Once I move the content of tree.html to the actual page. treeview plugin is working **ok!
treeview is being executed before the load has completed. You can use the complete callback of the load method to fix this
It’s worth noting that most operations in jQuery don’t block, so whenever you need to act on a load or an AJAX request, it’s best to use the provided callbacks.