Answer the question
In order to leave comments, you need to log in
How to get data from vue.js in django?
I am a complete newbie to working with server and databases. My task is to send an array from vue app to django server.
I have an array send function (not sure if it's written correctly).
sendResult: function() {
const xhr = new XMLHttpRequest();
xhr.open('POST', '/someroute', true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify(this.userAnswers));
},
from django.db import models
# Create your models here.
class EnglishTest(models.Model):
user_id = models.IntegerField()
test_num = models.IntegerField()
test_result = models.IntegerField()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question