Maybe Im just confusing myself due to being pressed for time, but how would I reuse this function without reloading the page itself?
$(function() {
var uploadqueue = $("#uploader").pluploadQueue({
// General settings
runtimes : 'html4,silverlight',
url : 'upload_file.json?hdfs_url=<%=@file_name%>&authenticity_token=<%= form_authenticity_token %>',
max_file_size : '100000000000mb',
//chunk_size : '1mb',
unique_names : true,
multipart: false,
multiple_queues: true,
//multipart_params: {
//"authenticity_token" : '<%= form_authenticity_token %>'
//},
// Flash settings
flash_swf_url : 'javascripts/plupload/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url : 'javascripts/plupload/plupload.silverlight.xap',
init : {
Refresh: function(up) {
// Called when upload shim is moved
$(".plupload_header_title").text("Upload files to HDFS");
$(".plupload_header_text").text("Files will go in: <%=@file_name%>");
},
StateChanged: function(up) {
// Called when upload shim is moved
$.get("file_tree?dir=<%=@file_name%>", function(data){
//alert("<%=@rel_link%>")
//alert("Command = ul[name*='<%=@rel_link%>']")
//alert("Data Loaded: " + $("ul[name*='<%=@rel_link%>']").html());
$("ul[name*='<%=@rel_link%>']").html($(data).children());
});
}
}
});