Can someone help me with this issue?
I have a form and a script to trigger an alert message. The code I'm using is working well:
<input id="autocomplete" class="input_message" type="text" name="message" autocomplete="off" placeholder="...type your message" ><br/>
<input id="input_send" class="input_send" type="submit" name="send" value="SEND">
However, when I add a form method, the alert in my script stops working.
<form enctype="multipart/form-data" method="post">
<input id="autocomplete" class="input_message" type="text" name="message" autocomplete="off" placeholder="...type your message" ><br/>
<input id="input_send" class="input_send" type="submit" name="send" value="SEND">
</form>
Below is the script I am using:
<div id="alertbox">
<script>
$(document).ready(function(){
$('#input_send').click(function(){
var post = $('#autocomplete').val();
if(post==""){
alert('Enter Message Please');
}else{
$('#loader').fadeIn(400).html('<img src="./loader.gif" align="absmiddle"> <span class="loading">sending</span>');
var datasend = "alert";
$.ajax({
type:'post',
url:'./includes/alerts.php',
data:datasend,
cache:false,
success:function(msg__){
$('#autocomplete').val('');
$('#loader').hide();
$('#alertbox').fadeIn('slow').prepend(msg__);
$('#alerts').delay(5000).fadeOut('slow');
}
});
}
})
});
</script>
</div>
Thank you for any assistance provided.