【发布时间】:2014-10-15 04:00:45
【问题描述】:
jQuery ->
test = path
if $('#spot-index-sortable').length > 0
$('#spot-index-sortable').sortable(
axis: 'y'
items: '.item'
cursor: 'move'
sort: (e, ui) ->
ui.item.addClass('active-item-shadow')
stop: (e, ui) ->
ui.item.removeClass('active-item-shadow')
# highlight the row on drop to indicate an update
ui.item.children('td').effect('highlight', {}, 1000)
update: (e, ui) ->
item_id = ui.item.data('item-id')
console.log(item_id)
position = ui.item.index() # this will not work with paginated items, as the index is zero on every page
$.ajax(
type: 'POST',
url: test+'admin/spot_categories/update_row_order',
dataType: 'json',
data: { category: {category_id: item_id, row_order_position: position } }
)
)
变量 test 将有一个来自 javascript 的值,然后我想在 $.ajax(url:test) 处连接上面的测试变量值。如何做到这一点
【问题讨论】:
-
什么是
path?这是在哪里定义的?
标签: coffeescript