我有以下Coffeescript:
$ ->
$('#new_event').submit ->
$.post(
$(this).attr('action')
$(this).serialize()
(data, textStatus, jqXHR) ->
$('#target').html(data)
)
return false
Run Code Online (Sandbox Code Playgroud)
它转化为:
$(function() {
return $('#new_event').submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(data, textStatus, jqXHR) {
return $('#target').html(data);
});
return false;
});
});
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.但是,如何在提交中添加另一行?例如:
$ ->
$('#new_event').submit ->
test = $(this).serialize()
$.post(
$(this).attr('action')
$(this).serialize()
(data, textStatus, jqXHR) ->
$('#target').html(data)
)
return false
Run Code Online (Sandbox Code Playgroud)
这会产生意外的INDENT错误.无法弄清楚我在这里失踪了什么......
谢谢,丹妮.
| 归档时间: |
|
| 查看次数: |
3308 次 |
| 最近记录: |