$(document).ready(function(){
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
var ticketCode = getUrlVars()["code"];
if(ticketCode){
$("#divDetails").hide();
$("#form").hide();
$.ajax({
method: 'POST',
url: '/160001/r-status.php',
data: "id=" + ticketCode,
success: function(data) {
if(data != "Not found"){
$("#divError").hide();
$("#divDetails").html(data);
$("#divDetails").show();
} else {
$("#divError").show();
}
},
error: function(e) {
console.log(e);
}
});
};
});
$("#divDetails").hide();
$("#divError").hide();
$("#btnCheck").click(function(){
$("#divDetails").hide();
var txtTicketCodePost = $("#txtTicketCode").val();
$.ajax({
method: 'POST',
url: '/160001/r-status.php',
data: "id=" + txtTicketCodePost,
success: function(data) {
if(data != "Not found"){
$("#divError").hide();
$("#divDetails").html(data);
$("#divDetails").show();
} else {
$("#divError").show();
}
},
error: function(e) {
console.log(e);
}
});
});