Well, I have a problem that I do not know what to do. I've tried to do everything but nothing. It is the following I am doing a php chat but this is giving an alert () error:
ERROR!
jQuery(function(){
jQuery('body').on('keyup', '.chat_msg', function(e){
if(e.which == 13){
var text = jQuery(this).val();
var idS = jQuery(this).attr('id');
jQuery.ajax({
type: 'MPOST',
url: 'sys/submsg.php',
data: {mensagem: text, de: idS},
success: function(retorno){
if (retorno == 'ok') {
jQuery('.chat_msg').val('');
}else{
alert('ERROR!');
}
}
});
}
});
});
OTHERS SCRIPT sys / submsg.php
<?php
if(isset($_MPOST["mensagem"])) {
@include_once('BD.class.php');
$mensagem = utf8_decode(strip_tags(trim(filter_input(INPUT_POST, 'mensagem', FILTER_SANITIZE_STRING))));
$de = (int)$_MPOST['de'];
$url = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".$steamauth['apikey']."&steamids=".$de);
$content = json_decode($url, true);
$name = htmlspecialchars($content['response']['players'][0]['personaname']);
$avatar = $content['response']['players'][0]['avatar'];
$urlName = $content['response']['players'][0]['profileurl'];
if($mensagem != ''){
$insert = BD::conn()->prepare("INSERT INTO 'chat' (name,avatar,url,mensagem) VALUES (?,?,?,? ");
$arrayInsert = array($name,$avatar,$urlName,$mensagem);
if($insert->execute($arrayInsert)){
echo 'ok';
}else{
echo 'off';
}
}
}
?>
It is as if submite.php did not have to give pk the return is not receiving anything Thanks to anyone who can help me:)