在jquery插件的成功事件上操作DOM

时间:2012-08-27 21:46:50

标签: javascript jquery asp.net ajax asp.net-mvc

在jquery插件成功的情况下,我需要操作DOM并创建/显示一些新的html控件......

HTML ..

<input type="file" name="fileupload" id="fileupload" />

<%=Html.ActionLink("TestA", "TestA", "ControllerA", new { Id = Id})%> 

<%=Ajax.ActionLink("TestB","TestB","ControllerB", new { Id= Id})%>

JS:

<script type="text/javascript">
$(function () {

    $('#fileupload').uploadify({
        'buttonText': 'Upload',
        'auto': true,
        'multi': false,
        'swf': '/Uploadify/uploadify.swf',
        'uploader': '/ControllerA/LinkMethod',
        'formData': { 'Id': Id},
        'debug': false,          
        'onUploadSuccess': function (file, data, response) {

         //Here I want to show two action links and disable/invisible the plugin.

        }
    });
}); 

1 个答案:

答案 0 :(得分:3)

只需为具有相应ID值的相应元素调用show()hide()

 'onUploadSuccess': function (file, data, response) {

        $('#MyIdForLink1').show();
        $('#MyIdForLink2').show();
        $('#pluginId').hide();

 }