Update categories_order.html.erb

fix error
This commit is contained in:
chiu 2019-09-19 18:38:12 +08:00
parent 5f2382583b
commit 0fd6c634bf
1 changed files with 27 additions and 25 deletions

View File

@ -1,31 +1,33 @@
<% all_locales = I18n.available_locales %> <% all_locales = I18n.available_locales %>
<% count = all_locales.length %> <% count = all_locales.length %>
<script> <script>
$('form[name="category_sort_number_form"]').submit(function(){ $('form[name="category_sort_number_form"]').on('load',function(){
var eles = $('form[name="category_sort_number_form"]').serialize().split('&') $('form[name="category_sort_number_form"]').submit(function(){
var keys=[],values=[] var eles = $('form[name="category_sort_number_form"]').serialize().split('&')
for (var ele in eles){ var keys=[],values=[]
var temp = ele.split('=') for (var i=0;i<eles.length;i++){
keys.push(temp[0]) var temp = eles[i].split('=')
values.push(temp[1]) keys.push(temp[0])
} values.push(temp[1])
if (navigator.onLine) { }
$.ajax({ if (navigator.onLine) {
url : "/admin/archive_files/categories_order", $.ajax({
dataType : "json", url : "/admin/archive_files/categories_order",
type : "post", dataType : "json",
data:{data_keys: keys, data_values: values}, type : "post",
success:function(data){ data:{data_keys: keys, data_values: values},
location.reload(); success:function(data){
}, location.reload();
error:function(){ },
alert('Your server has some problem, please try again later!') error:function(){
} alert('Your server has some problem, please try again later!')
}) }
} else { })
alert('Please connect the network and try again later!') } else {
} alert('Please connect the network and try again later!')
return false; }
return false;
})
}) })
</script> </script>
<form method="post" action="/admin/archive_files/categories_order" name="category_sort_number_form" > <form method="post" action="/admin/archive_files/categories_order" name="category_sort_number_form" >