1、get接口数据处理
# get接口数据处理
def dadaHandle_get(request):
if request.method == 'GET':
results = {}
username = request.GET.get('username')
mobile = request.GET.get('mobile')
data = request.GET.get('data')
results['user'] = username
results['mobileNum'] = mobile
results['data']= data
results =json.dumps(results)
return HttpResponse(results,content_type='application/json;charset=utf-8')
else:
return render_to_response('login.html')
2、post接口数据处理
def dadaHandle_post(request):
if request.method == 'POST':
results = {}
username = request.POST.get('username')
password = request.POST.get('password')
results['user'] = username
results['pwd'] = password
results =json.dumps(results)
return HttpResponse(results,content_type='application/json;charset=utf-8')
else:
return render_to_response('login.html')