Hi Team,

I am making quiz app, for which i wrote a function in view which will 
generate the json file and place it under the same location as of my all 
teamplates (C:/Desktop/Environment/envQuiz/quizsetup/templates/quizsetup)
Now I am trying to read this json file in my HTML page via javascript file, 
and getting error as attached "Issue1.PNG".

Please help... I also tried using header.. but no luck.

Below is the js code i am using.
<script type="text/javascript">
var requestURL = 
'C:/Desktop/Environment/envQuiz/quizsetup/templates/quizsetup/json_data.json';
let questions;
let questionsCount;
let currentQuestion;
let score = 0;

let question_title_elem = document.getElementById("title");
let answers_elem = document.getElementById("answers");
let action_btn = document.getElementById("action_btn");

function getQuestions () {
let request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) { 
questions = JSON.parse(this.responseText).questions;
questionsCount = questions.length;
currentQuestion = 0;
}
}

/*json_data -- This is from view takeQuiz */
request.open("GET", requestURL, false);
request.send();
....
.
..
.
.
.
...
</script>



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57fd8bf5-8056-4355-b1ec-77247445e48d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to