im growing php kind for electronic mail with ajax in order that web page doesnt should refersh.
<kind class="get-form" methodology="put up" motion="get-quote.php">
<div class="text-center form-fill">
<h4 class="output_message" id="message"></h4>
</div>
//form-field
</kind>
After kind have been efficiently submitted message will probably be displayed in “H4.output_message”. with following ajax code.
$(doc).prepared(perform() {
$('.get-form').on('submit',perform()
// Add textual content 'loading...' proper after clicking on the submit button.
$('.output_message').textual content('Loading...');
var kind = $(this);
$.ajax(
url: kind.attr('motion'),
methodology: kind.attr('methodology'),
information: kind.serialize(),
success: perform(end result)
$("kind")[0].reset();
if (end result == 'success')
$('.output_message').textual content('Message Despatched!');
else
$('.output_message').textual content('Error Sending electronic mail!');
);
return false;
);
});
Every thing works wonderful however i need conceal “div.form-fill” when h4.out_message is empty as i’ve performed some css styling. i need to show “div.form-fill” solely when h4.out_message have some textual content.
Works wonderful with JavaScript however couldn’t work out with ajax