spring-mvc使用ajaxFileUpload上传文件返回添加自动<per>处理

  1. uploadHttpData : function(r, type) {  
  2.                 var data = !type;  
  3.                 data = type == "xml" || data ? r.responseXML : r.responseText;  
  4.                 // If the type is "script", eval it in global context  
  5.                 if (type == "script")  
  6.                     jQuery.globalEval(data);  
  7.                 // Get the JavaScript object, if JSON is used.  
  8.                 if (type == "json")  
  9.                     // eval( "data = " + data );  
  10.                     // data会被加<pre>导致AJAX不走success方法,改为如下形式  
  11.                     // eval("data = \" "+data+" \" ");  
  12.                     data = jQuery.parseJSON(data);  
  13.                 // evaluate scripts within html  
  14.                 if (type == "html")  
  15.                     jQuery("<div>").html(data).find('script').remove();  
  16.                 return data;  
  17.             },  

猜你喜欢

转载自xianlincai.iteye.com/blog/2346102