Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- var isAjaxing = false;
- var xmlHttp;
- var qsMode, qsID;
- qsMode = gup("mode");
- qsID = gup("id");
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlHttp = new XMLHttpRequest();
- } else {
- // code for IE6, IE5
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- function open_notes() {
- $("#modal_content").modal();
- load_notes();
- }
- function load_notes() {
- var theDiv = document.getElementById("note_display");
- xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
- theDiv.innerHTML = xmlHttp.responseText;
- } else if (xmlHttp.status == 404) {
- theDiv.innerHTML = "Error retrieving notes";
- }
- }
- xmlHttp.open("GET", "ajax.aspx?mode=note&do=view&id=100760&fromMode=permits", true);
- //xmlHttp.open("GET", "ajax.aspx?mode=note&do=view&id=" + qsID + "&fromMode=" + qsMode, true);
- xmlHttp.send();
- }
- function add_note() {
- if (isAjaxing) {
- return false;
- }
- var theSpan = document.getElementById("txtSuccess");
- xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
- if (xmlHttp.responseText == "true") {
- theSpan.innerHTML = "Note added!";
- load_notes();
- isAjaxing = false;
- } else {
- alert(xmlHttp.responseText);
- theSpan.innerHTML = "Error adding note";
- }
- } else if (xmlHttp.status == 404) {
- theSpan.innerHTML = "Error adding note";
- }
- document.getElementById("add_note_throbber").src = "/Styles/throbber_empty.png";
- }
- var noteText;
- noteText = encodeURIComponent($("#txtAddNoteText").val());
- if (noteText.length < 1) {
- theSpan.innerHTML = "Note cannot be empty";
- return false;
- }
- var params = "noteText=" + noteText;
- xmlHttp.open("POST", "ajax.aspx?mode=note&do=add&id=100760&fromMode=permits", true);
- //xmlHttp.open("POST", "ajax.aspx?mode=note&do=view&id=" + qsID + "&fromMode=" + qsMode, true);
- xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xmlHttp.send(params);
- isAjaxing = true;
- document.getElementById("add_note_throbber").src = "/Styles/throbber.gif";
- }
Add Comment
Please, Sign In to add comment