ajaxFileUpload SyntaxError:Unexpected token <

uploadHttpData: function( r, type ) {
    	var data = !type;
        data = type == "xml" || data ? r.responseXML : r.responseText;
        // If the type is "script", eval it in global context
        if ( type == "script" )
            jQuery.globalEval( data );
        // Get the JavaScript object, if JSON is used.
        if ( type == "json" ) {
             ////////////如下爲新增代碼///////////////
             data = r.responseText;
             var start = data.indexOf(">");
             if(start != -1) {
        	   var end = data.indexOf("<", start + 1);
        	   if(end != -1) {
        	     data = data.substring(start + 1, end);
        	    }
             }
              ///////////以上爲新增代碼///////////////
              eval( "data = " + data);
        }
        // evaluate scripts within html
        if ( type == "html" )
            jQuery("<div>").html(data).evalScripts();

        return data;
    }

將<pre></pre>標籤去掉html

相關文章
相關標籤/搜索