Loading data.json with html in ordinary folder

تبليغ
سؤال

يرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.

تبليغ
‎إلغاء

I’ve html:

….
<script src=”./jquery-3.6.0.min.js”></script>
<script src=”./data.json”></script>
<script>
$.getJSON(‘./data.json’, function (jd) {
console.log(jd);
});
</script>


It works in localhost, if e.g index.html and data.json are in xamp/htdocs-folder, but in C:myfiles..index.js (that browser url is file:///C:/…/index.html).
I want to do a downloadable service for customers. Everybody cannot put into some xampp/htdocs/.. folder and whatch in localhost.

‫أضف إجابة

تصفح
تصفح

مجهول يجيب