callbax, yo

This commit is contained in:
danielgrippi 2012-03-13 15:22:32 -07:00 committed by Dennis Collinson
parent 37bf5c5aee
commit 6dce04d2f5
2 changed files with 10 additions and 6 deletions

View file

@ -41,6 +41,7 @@ class PhotosController < ApplicationController
end
def create
raise "THAT IS NOT OKAY"
rescuing_photo_errors do |p|
if remotipart_submitted?
@photo = current_user.build_post(:photo, params[:photo])

View file

@ -4,12 +4,15 @@
= f.submit
:javascript
// ugly hax to take us from remotipart land to normal backbone land
$(function(){
console.log($('#new_photo'))
$('#new_photo').bind('ajax:success', function(event, data) {
alert("happy day")
console.log(data)
console.log(new Backbone.Model(data)); // Your newly created Backbone.js model
$('#new_photo').bind('ajax:complete', function(evt, xhr) {
resp = JSON.parse(xhr.responseText)
if(resp.success) {
console.log("response was successful");
} else {
console.log(resp.error);
};
});
//console.log(new Backbone.Model(data)); // Your newly created Backbone.js model
});