Topic: Problem with Ajax
I have form and an ajax call in my application.js
$('#mynote').submit(function() {
var valuesToSubmit = $(this).serialize();
alert('test');
$.ajax({
type: "POST",
url: "/mirror/setnote",
data: valuesToSubmit,
});
return false
});My controller:
def setnote
@mynote = Note.find_by_mirror_id_and_user_id(session[:mirror_id],session[:user_id])
@mynote.note = params[:note]
@mynote.save
endIt run the method but why doesn't the alert work?