if auth_user:
auth.login(request, auth_user)
authed_user = serializers.serialize('json',
fxcn_user.objects.filter(username=user))
return HttpResponse
(json.dumps(authed_user),content_type="application/json")
前端jquery得到的json数据为:
"[{\"fields\": {\"username\": \"figure\", \"first_name\": \"\", \"last_name\": \"\", \"phone\": null, \"updated_at\": \"2015-06-27T02:02:17.622Z\", \"created_at\": \"2015-06-27T02:02:17.622Z\", \"is_active\": true, \"sig_info\": null, \"office_ext\": null, \"sex\": null, \"is_superuser\": true, \"birthday\": null, \"last_login\": \"2015-07-01T08:01:31.844Z\", \"groups\": [], \"user_permissions\": [], \"password\": \"pbkdf2_sha256$20000$GCVkdJZAApJC$qZLsefU0HqKKG9M4Y9OPgI4ZWMUYAIC8tInNIOSBKRo=\", \"friends\": null, \"email\": \"f@f.com\", \"icon\": \"user_icon/default.jpeg\"}, \"model\": \"fxcn_auth.fxcn_user\", \"pk\": 1}]"
前端jquery ajax成功后的处理函数
success:function(response, status, xhr){
$('#login_form').dialog('widget').find('button').eq(1).button('enable')
alert(response);
请问: 如果从返回的json数据中得到用户名,邮箱等信息??
我尝试了alert(response.username)提示undefined;
}