以下代码是发送消息的代码……我想检查一下,当用户选择任何过滤器并保留默认过滤器“SELECT”时,这些块不会在他们的消息中发送给用户。 ....谢谢你的时间
$('#sendMessageButton').click(function(){
$('#result').removeClass("alert-message error");
$('#result').html('');
$('#sendMessageButton').attr('value','Sending...');
$('#sendMessageButton').addClass('disabled');
if($('#messageType').val() == 'contactme'){
$('#content').val(encodeURIComponent('<div id ="ask-a-question-message" style="padding:15px;"><div style="color:#63872C;font-size:14px;font-weight:bold;margin-bottom:20px;">Hey, I have a question for you!</div><div style="background-color:#F3F3F3;padding:7px;"><div style="font-style:italic;margin-bottom:5px;">Some information for my trip</div><div style="font-size:13px;font-weight:bold;color:#777;margin-top:10px;">Date arriving in ${user.city.label}</div><div>'+$('#travel-date').val()+'</div><div style="font-size:13px;font-weight:bold;color:#777;margin-top:10px;">Traveler type</div><div>'+$('#travel-type').val()+'</div><div style="font-size:13px;font-weight:bold;color:#777;margin-top:10px;">Budget</div><div>'+$('#budget-type').val()+'</div></div><div style="padding:7px;"><div style="font-size:13px;font-weight:bold;color:#777;margin-top:10px;"">Question</div><div>'+$('#preselected-question').val()+'</div><div>'+$('#freeform-question').val()+'</div></div></div>'));
}
$.post(sendMessage({recipientId:$('#recipientId').val(),messageType:$('#messageType').val(),itemId:$('#itemId').val(),content:$('#content').val().replace(new RegExp('\n','g'), '<br />')}), function(data) {
if(!(data.data && data.data.error)){
$('#sendMessageButton').removeClass('btn-primary');
$('#sendMessageButton').addClass('success');
$('#sendMessageButton').attr('value','Message sent');
setTimeout(function() {
$('#new-message-modal').modal('hide');
}, 1000);
setTimeout(function() {
$('#sendMessageButton').removeClass('disabled');
$('#sendMessageButton').attr('value','Send');
}, 1500);
}
else{
$('#result').addClass("alert-message error");
$('#result').html(data.data.error);
}
})
})
//else