Which method should I use, load() or ajax()? This is not something I have done before, so I'm a little confused what the difference is.
1 Answer
load() is just a shortcut for ajax() method with certain options. If you only need to fetch page and place it in the dom, you can use load() method. If you need more control over the ajax request, or you need to call it with some other options, then go for ajax().
3 Comments
mtwallet
@Giorgi I do want to fetch and place the page, ideally I'd like to wait until it loads then fade the page in, would this be a job for ajax()?
Giorgi
@mtwallet ajax() is for controlling the fetching itself and not animations. You can pass callback to load() which will be executed once the request completes.
mtwallet
one last question if I may. Would I have to use unload() first to ensure the div I am placing content into is empty?