$("#readerId").blur(function(){ var readerId=$("#readerId").val(); $.ajax({ type:"post",url:"<%=request.getContextPath()%>/selectReadersById1.action",data:{"readerId":readerId},dataType:"text",success:function(data) { var myobj=eval(data); //for(var i=0;i<myobj.length;i++){ $("#readerName").val(myobj[0].name); $("#borrowNum").val(myobj[0].maxNum); $("#yajin").val(myobj[0].keepMoney); //} } }) })