标签:
from django.conf.urls import url from django.contrib import admin import AjaxTest.views urlpatterns = [ url(r‘^admin/‘, admin.site.urls), url(r"^index/$",AjaxTest.views.index), ]
from django.http import HttpResponse def index(req): print req.GET.get(‘url‘) if req.GET.get(‘url‘)==‘test‘: return HttpResponse("hello,this is a test") else: return HttpResponse("hahahaha")
$("input").click(function() { $.get("/index/?url=test", function (response, status, xhr) { $(".box").html(response); }); });
$("input").click(function() { $.get("/index/", "url=test", function (response, status, xhr) { $(".box").html(response); }); });
$("input").click(function() { $.get("/index/",{ url:"test" },function(response,status,xhr){ $(".box").html(response); }); });
标签:
原文地址:http://www.cnblogs.com/Yellow0-0River/p/5499885.html