django 3种返回json方法 1.手动组装字典返回 from django.http import JsonResponse, HttpResponse from django.shortcuts import render from app01.models import Book # Create your views here. def get_book(request): all_book = Book.objects.all() d = [] for i in all_book:
这两天在做关于读取json数据的插件,想用getJSON读取数据: $.getJSON(http://www.xxxx.com/Titles.js, function (data) { console.log(data); }); 出现一下文字 XMLHttpRequest cannot load http://www.xxxx.com/Titles.js. Origin http://my.xxxx.com is not allowed by Access-Control-Allow-Orig