django使用json简易速成

 

django中代码:

 

from django.http import HttpResponse
from django.utils import simplejson

 

 

def searchVIP(request):
print "vip id: "+request.GET['id']
tempJson={'point':10}
return HttpResponse(simplejson.dumps(tempJson))

 


$(function(){
$("#searchVIPBtn").click(function(){
$.get("/searchVIP/",{id:encodeURI($("#inputVIP").val())},function(data){
var result=JSON.parse(data)
alert("you get "+result.point);
})
})
});

posted on 2013-06-20 00:14  TheKingOfKingFish  阅读(312)  评论(0编辑  收藏  举报

导航