//jQuery POST AJAX function pAjax(send_to, form_id, result_div_id, hide_form, callBackFunction) { document.getElementById(result_div_id).innerHTML = '
Please wait
'; $.post( send_to, $( "#"+form_id ).serialize() ) .done(function( data ) { document.getElementById(result_div_id).innerHTML = data; if (hide_form === true) { document.getElementById(form_id).innerHTML = ""; } if (typeof callBackFunction !== 'undefined') window[callBackFunction](); }) .fail(function () { document.getElementById(result_div_id).innerHTML = '
Network error
'; }); } //jQuery GET AJAX function gAjax(send_to, result_div_id, should_concat) { $.get( send_to, function( data ) { if(should_concat) $( "#"+result_div_id ).append( data ); else $( "#"+result_div_id ).html( data ); }); } //jQuery Recall Ajax function rAjax(send_to, result_div_id, recall_interval, callBackFunction) { $.get( send_to, function( data ) { $( "#"+result_div_id ).html( data ); if (typeof callBackFunction !== 'undefined') { window[callBackFunction](); if (recall_interval > 0) setTimeout("ajax( '" + send_to + "', '" + result_div_id + "'," + recall_interval + ",'" + callBackFunction + "')", recall_interval); } else if (recall_interval > 0) setTimeout("rAjax( '" + send_to + "', '" + result_div_id + "'," + recall_interval + ")", recall_interval); }); } // PURE JAVASCRIPT AJAX function ajax(queryString, outputDiv, recallInterval, callBackFunction) { var xmlHttp; try { xmlHttp = new XMLHttpRequest(); } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange = function () { if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200)) { document.getElementById(outputDiv).innerHTML = xmlHttp.responseText; if (typeof callBackFunction !== 'undefined') { window[callBackFunction](); if (recallInterval > 0) setTimeout("ajax( '" + queryString + "', '" + outputDiv + "'," + recallInterval + ",'" + callBackFunction + "')", recallInterval); } else { if (recallInterval > 0) setTimeout("ajax( '" + queryString + "', '" + outputDiv + "'," + recallInterval + ")", recallInterval); } } } xmlHttp.open("GET", queryString, true); xmlHttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xmlHttp.send(null); } // SHOW MODAL function modal(url, heading) { //url = url+'&&time='+ new Date().getTime(); $("#myModal").modal('show'); $("#myModalHeading").html(heading); $("#myModalBody" ).html(''); $("#myModalBody").load(url, function (response, status, xhr) {if (status=="error") {$( "#myModalBody" ).html( "
Error occurred: " + xhr.status + " " + xhr.statusText + "
");}}); }