I have the following situation ...
doLoad = function (livrosList){
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://servidor_remoto/webservice/webs.php", true);
xmlhttp.setRequestHeader("Content-Type", "application/json; charset=utf-8");
arqJson = JSON.stringify(livrosList);
xmlhttp.send(arqJson);
}
include('LivrosList.php');
header('Content-Type: application/json; charset=utf-8');
header("access-control-allow-origin: *");
$obj_php = json_decode(stripslashes($_POST['arqJson']));
if(empty($_POST['arqJson'])){
return;
}
$livros = new Livros;
foreach ( $obj_php as $liv ) {
$livros->insertLivros($liv->nome, $liv->numeropaginas);
}
The problem is that $ _POST ['arqJson'] is not being recognized. I see that in the Apache log it is occurring that arqJson is not set. I do not know if it's because it's on a remote server. So how could I send this list of data to the webservice and store such data in the database? Thanks in advance for your help!