Skip to content

Instantly share code, notes, and snippets.

@ArunGupta25
Created June 12, 2012 22:46
Show Gist options
  • Save ArunGupta25/2920607 to your computer and use it in GitHub Desktop.
Save ArunGupta25/2920607 to your computer and use it in GitHub Desktop.
def aviarycreate
@photo = Photo.new
@photo.user_id = current_user.id
@photo.remote_image_url = params[:url]
@photo.save
respond_to do |format|
format.json { render json: @photo }
end
end
function postImage(imageID, newURL) {
$.ajax({
type: 'POST',
url: '/aviarycreate',
data: { url : newURL},
headers: {
'X-Transaction': 'POST Example',
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
},
success: function(msg) {
console.log(msg);
//console.log(msg.image);
//console.log(msg.image.url)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment