Can anyone tell me why this coffee script:
$ ->
$('#btnLogin').live 'click', ->
$.ajax
url: 'user/login'
type: 'POST'
data: 'Username=' + $('#username').val() + '&password=' + $('#password').val()
success: (data, status, request) ->
alert data
Generates this javascript with the ajax call outside the document ready method?
(function() {
$(function() {
return $('#btnLogin').live('click', function() {});
});
$.ajax({
url: 'user/login',
type: 'POST',
data: 'Username=' + $('#username').val() + '&password=' + $('#password').val(),
success: function(data, status, request) {
return alert(data);
}
});
}).call(this);
This was actually a problem with tab spacing in visual studio, I changed the tab spacing while I was working on the file and it ballsed everything up. I just deleted all the spacing and tabbed in on every line and then it generated the js I wanted