is nested function calling possible in jquery

Solution 1:

.load() is asynchronous, and the second function isn't waiting for the first one to finish, so the #icon element isn't in the DOM when it runs. You need to do it in the callback function.

$(function() {
  $("#socials").load("sources/socials.html", function() {
    $("#icon").load("img/icon.xml");
  });
});