0
我有這樣的要求表單提交後發送郵件。如何顯示加載消息在相同的分區結果顯示
post_data = {'userName':name, 'userEmail':email, 'userMessage':message};
//Ajax post data to server
$.post('contact_me.php', post_data, function(response){
//load json data from server and output message
if(response.type == 'error')
{
output = '<p style="color:red;" class="help-block">Oh no!! Error occured</p>';
}else{
output = '<p style="color:green;" class="help-block">'+response.text+'</p>';
//reset values in all input fields
$('#contact_form input').val('');
$('#contact_form textarea').val('');
}
$("#result").hide().html(output).slideDown();
}, 'json');
得到迴應後,我將顯示消息這個div
<div id="result" class="col-md-8"></div>
現在我需要在這同一div來顯示加載信息,而Ajax請求正在處理。怎麼做?我見過很多答案,但沒有涉及到這種類型的查詢
當呼叫被解僱,更新元素的HTML說裝載,成功刪除此消息 –