ajax--->简单加法小练习
index.HTML
Title + =
views.py
from django.shortcuts import render,HttpResponse# Create your views here.def index(request): return render(request,"index.html")def get_ajax(request): first=request.GET.get("a") second=request.GET.get("b") reg= float(first)+float(second) return HttpResponse(reg)
urls.py
from django.conf.urls import urlfrom django.contrib import adminfrom app01 import viewsurlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/',views.index), url(r'^get_ajax/', views.get_ajax),]