This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kawfee and js, and a Guardfile to compile the script automatically
- Loading branch information
Iain Barnett
committed
Mar 7, 2012
1 parent
c71d866
commit da1c3b2
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard 'coffeescript', :input => "coffee", :output => 'public/js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
jQuery ($) -> | ||
|
||
$.ajaxSetup | ||
data: | ||
c: 3, | ||
d: 4 | ||
|
||
|
||
$("#form1").submit -> | ||
console.log( "ser: #{$(@).serialize()}") | ||
$.ajax | ||
url: "/" | ||
data: $(@).serialize() | ||
type: "POST" | ||
success: (res, status, xhr) => | ||
console.log "res: #{res}" | ||
error: (xhr,status, err) => | ||
console.log "failed with error: #{err}" | ||
complete: (xhr, status) => | ||
console.log("finished with status: #{status}") | ||
false # prevent form submission via html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(function() { | ||
|
||
jQuery(function($) { | ||
$.ajaxSetup({ | ||
data: { | ||
c: 3, | ||
d: 4 | ||
} | ||
}); | ||
return $("#form1").submit(function() { | ||
var _this = this; | ||
console.log("ser: " + ($(this).serialize())); | ||
$.ajax({ | ||
url: "/", | ||
data: $(this).serialize(), | ||
type: "POST", | ||
success: function(res, status, xhr) { | ||
return console.log("res: " + res); | ||
}, | ||
error: function(xhr, status, err) { | ||
return console.log("failed with error: " + err); | ||
}, | ||
complete: function(xhr, status) { | ||
return console.log("finished with status: " + status); | ||
} | ||
}); | ||
return false; | ||
}); | ||
}); | ||
|
||
}).call(this); |