universal_table/app/views/admin/universal_tables/index.html.erb

26 lines
624 B
Plaintext

<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/jquery.form" %>
<% end %>
<div id="index_table">
<%= render 'index'%>
</div>
<script type="text/javascript">
$("form.import_from_excel_form").on("submit",function(){
var form = this;
if($(this).find("input[type=file]").val() != ""){
$(this).ajaxSubmit({
dataType : "json",
success : function(data){
if(data.success){
alert("Import successfull.")
$("tr#table_" + data.id + " td:eq(2)").text(data.count);
}else{
alert(data.msg);
}
form.reset();
}
})
}
return false;
})
</script>