Solution 1 :

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($ => {

function loadContent(path) {

Problem :

I want to pass some files path into a JavaScript or Jquery function, so this can display those files (HTML files) into a div when clicking an a tag.

its possible?

something like this:

    $(document).ready(function loadcontent(pathfile){

The div:

<div id="content">


Comment posted by Keith

Browser’s Javascript does not have direct access to files, no.

Comment posted by jose alexander pascual rosa

@Keith the files are hosted on a server, not even like that?

Comment posted by Keith

@josealexanderpascualrosa You maybe need to update your question ->