In Sharepoint, when we load the sp.js file after that when we use given code then it gives the current site context. But how can i get the site context using url.
var context = new SP.ClientContext.get_current();
get_current() would always return current context only. If you want to get context of particular site then you would need to pass url in
var context = new SP.ClientContext(URL);
In case you want to get root site context then you can directly use