80 lines
2 KiB
JavaScript
80 lines
2 KiB
JavaScript
let $j = jQuery.noConflict();
|
|
|
|
$j(function(){
|
|
|
|
let currentMsg;
|
|
let currentMsgRef;
|
|
|
|
$j('body').on('click', '.answer-msg', function(e){
|
|
e.preventDefault();
|
|
|
|
currentMsg = $j(this).data('id');
|
|
currentMsgRef = $j(this).data('ref');
|
|
|
|
$j.post(
|
|
ajaxurl,
|
|
{
|
|
'action': 'getReponseForMsg',
|
|
'id' : currentMsg,
|
|
},
|
|
function(response){
|
|
$j('#reponse-msg').empty().html(response);
|
|
$j.fancybox.open({
|
|
src : '#reponse-msg',
|
|
type : 'inline',
|
|
afterClose: function (){
|
|
window.location.reload();
|
|
},
|
|
closeBtn: true
|
|
});
|
|
}
|
|
);
|
|
|
|
});
|
|
|
|
$j('body').on('click', '.show-msg', function(e){
|
|
e.preventDefault();
|
|
|
|
currentMsg = $j(this).data('id');
|
|
|
|
$j.post(
|
|
ajaxurl,
|
|
{
|
|
'action': 'getMsg',
|
|
'id' : currentMsg,
|
|
},
|
|
function(response){
|
|
$j('#reponse-msg').empty().html(response);
|
|
$j.fancybox.open({
|
|
src : '#reponse-msg',
|
|
type : 'inline',
|
|
afterClose: function (){
|
|
window.location.reload();
|
|
},
|
|
closeBtn: true
|
|
});
|
|
}
|
|
);
|
|
|
|
});
|
|
|
|
$j('body').on('click', '.send-answer', function(e){
|
|
e.preventDefault();
|
|
let email = $j('#emailTosend').val();
|
|
let message = $j('#msgTosend').val();
|
|
$j.post(
|
|
ajaxurl,
|
|
{
|
|
'action': 'sendReponse',
|
|
'email' : email,
|
|
'message' : message,
|
|
'id' : currentMsg,
|
|
'ref': currentMsgRef
|
|
},
|
|
function(response){
|
|
$j('#reponse-msg').empty().html(response);
|
|
}
|
|
);
|
|
})
|
|
|
|
});
|