Although jQuery helped to simplify the javascripts alot, it's still ugly and hard to maintain in the future. Let me know if you have any other non-ugly solution.
var myurl = "../json/addNotes";
var varUserName = '${userName}';
$.ajax({url:myurl,dataType: 'json', data:'comments='+comments+'&userName='+varUserName,
success: function(){
alert("Comments saved.");
$('#Comments').val("");
},
error: function(){
alert("Saving was unsuccessful, please try again.");
}
}
);
}
Comments
Post a Comment