2014-12-19 47 views
0

我使用的Bootstrap具有自己的jQuery文件,但我需要在我的网页中使用下面的代码来获取上传的文件的URL。正如你所看到的,问题在于它使用了1.7版本的jQuery,而Bootstrap的版本根本无法使用。 我现在面临着一个两难:如果我使用jQuery的1.7版本,页面的其余部分将不会正确显示,但脚本将工作。如果我使用最新版本,我会得到完全相反的结果。我该怎么办 ?是否有翻译代码的意思?无法使用使用jQuery版本的上传脚本

预先感谢您!

<script> 
    jQuery(document).ready(function() 
    { 

    var options = { 
     beforeSend: function() 
     { 
     $("#progress").show(); 
     //clear everything 
     $("#bar").width('0%'); 
     $("#alerte").html(""); 
     $("#percent").html("0%"); 
     }, 
     uploadProgress: function(event, position, total, percentComplete) 
     { 
     $("#bar").width(percentComplete+'%'); 
     $("#percent").html(percentComplete+'%'); 


     }, 
     success: function() 
     { 
     $("#bar").width('100%'); 
     $("#percent").html('100%'); 

     }, 
    complete: function(response) 
    { 
     $("#alerte").html("<font color='green'>"+response.responseText+"</font>"); 
    }, 
    error: function() 
    { 
     $("#alerte").html("<font color='red'> ERROR: Unable to upload the files</font>"); 

    } 

    }; 

     $("#myForm").ajaxForm(options); 

    }); 

    </script> 
+0

如何(这心不是很大)? – atmd

回答

0

如果您必须使用依赖于早期版本的插件,包括jQuery的多个版本,例如,你需要使用$.noConflict()

以使用两个版本,并设置一至noconflict别名看看docs here,有点的tutorial here