I have two user controls on the page, and one of the user controls has this text. which is used to add a note, but when they click the "Add note" button, the page reloads. I do not want the page to reload, I was looking for an example that is done without postback.
thank
I'm tired of doing this with JSON, but it throws the following error
The HTTP POST protocol used to access the path '/ Documents / TestNote / Documents / AddNote' is not allowed.
<script type="text/javascript">
$(document).ready(function() {
$("#btnAddNote").click(function() {
alert("knock knock");
var gnote = getNotes();
if (gnote == null) {
alert("Note is null");
return;
}
$.post("Documents/AddNote", gnote, function(data) {
var msg = data.Msg;
$("#resultMsg").html(msg);
});
});
});
function getNotes() {
alert("I am in getNotes function");
var notes = $("#txtNote").val();
if (notes == "")
alert("notes is empty");
return (notes == "") ? null : { Note: notes };
}
</script>
</asp:Content>
source
share