ajax如何输出json字符串中的一个对象?
如图,我想在下面的标签中只显示11111而不是{"username":"11111"}。
```javascript
<script type = "text/javascript">
$(document).ready(function(){
$('#name1').keyup(function(){
var a={};
a.username = $('#name1').val();
$.get('/hello',a,function(res){
console.log(res);
a=JSON.stringify(res)
$('#info').text(a);
});
});
});
</script>
后端代码:
@app.route('/hello') # 路由
def test_post():
a=request.args
return a