I have a $.ajax
that run file in php and pass a variable (email andress). The file works very good but the xhr.status
is 0
.
This is the code:
$.ajax({
type: 'POST',
url: 'file.php',
data: { email: destinatario },
complete: function(xhr,status){
$('#momentaneo, #force').remove();
alert(xhr.status);
if(xhr.status === 200){
alert('ok');
}
else{
alert('no');
}
}
});
This file.php
, independently xhr.status
, works fine and it add a user to my newsletter. So i don't think that this file is the problem..
It has "0755" permission files and if i run the url of file.php
with browser there aren't problems.
The problem is that xhr.status
is 0
and i don't understand why...
I read that could be "cross-site-scripting" but i don't know if is possibile in my case. I tried also to change tag form
in div
but nothing.
I add also the file.php
:
<?php
include('wrapper.php');
$apikey = "76a21109637d7391d1e68e9680e6";
voxmail_init($apikey);
voxmail_user_subscribe(array('mail' => $_POST['email'],'privacy' => 1),$_SERVER['REMOTE_ADDR']);
$header = "Content-type: text/html";
header($header);
print('<b>ok</b>');
?>
voxmail are API of newsletter service (i'm sure 101% that api are not problem)
i hope can you help me, thank a lot and sorry for my english