It depends on the path. If it’s a local path (eg. file://C:/foo.txt
) then no, you cannot do this for security reasons.
If it’s a relative path to a public resource held on your own server (eg. /folder/file.html
) then yes, this is possible. In your case you would just need to fix your syntax to create a valid function and provide the argument to load()
:
jQuery($ => {
loadContent('/path-to-your/file.html');
});
function loadContent(path) {
$('#content').load(path);
}