function test(callback){
$.ajax({ url:'/mall/credit', type: 'get', dataType:'json',processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头success: function(response){
credit = response.data.credit; callback(credit); }, error: function(){ alert("error"); } });}test(function(data){ console.log(data);})