I have an Ajax code that takes data from a simple message field and sends it to my database without the page being updated, but the problem is that everything works perfectly just from the computer , when accessing the cell phone simply does not happen.
HTML
<form method="post" action="../controller/SendChatMessage.class.php?act=open_chat&id_unique_talk=<?=$get_id_unique_talk?>&to_id=<?=$get_id_para?>" id="send_message_chat" ajax="true">
<div class="col-sm-10">
<div class="message-area">
<textarea placeholder="Message" rows="10" name="message" id="txt_message"></textarea>
</div>
</div>
<button style="height:28px;margin-top:-39px !important;" type="submit" class="btn btn-primary pull-right"> <i class="fa fa-send"></i></button>
</form>
JavaScript
<script type="text/javascript">
$(document).ready(function(e) {
$("form[ajax=true]").submit(function(e) {
e.preventDefault();
var form_data = $(this).serialize();
var form_url = $(this).attr("action");
var form_method = $(this).attr("method").toUpperCase();
$("#loading").show();
$.ajax({
url: form_url,
type: form_method,
data: form_data,
cache: false,
success: function(returnhtml){
$("#result").html(returnhtml);
$("#loading").hide();
document.getElementById('txt_message').value='';
}
});
});
});
</script>
Could anyone help me?