jQuery(function($) {
// create a convenient toggleLoading function
var toggleLoading = function() { $("#loading").toggle() };
$("#new_post")
.bind("ajax:loading", toggleLoading)
.bind("ajax:complete", toggleLoading)
.bind("ajax:success", function(event, data, status, xhr) {
$("#response").html(data);
});
});
это моя функция js (или Симона Карлетти ), и я хочу преобразовать ее в coffeescript, хотя у меня возникли проблемы с последними двумя обратными вызовами.
Мой coffeescript выглядит так
jQuery ->
$("#new_post")
.bind("ajax:loading", toggleLoading)
.bind("ajax:complete", toggleLoading)
.bind("ajax:success", (event, data, status, xhr) ->
alert(data)
.bind("ajax:failure", (event, data, status, xhr) ->
alert(data)
но я получаю Error: unclosed INDENT on line 21
спасибо заранее