Your problem is because " link " has a subdomain different from " link " even if the domain is the same the 'test' subdomino is different from 'www', if you want it to work you must add the CORS headers to your contact.php file.
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
Unfortunately this gives access to any domain
Another solution would be
$http_origin = $_SERVER['HTTP_ORIGIN'];
if ($http_origin == "https://www.miweb.com" || $http_origin == "http://www.domain2.com" || $http_origin == "https://prueba.miweb.com")
{
header("Access-Control-Allow-Origin: $http_origin");
}
Finally you could modify your .htaccess file if you use apache. To make something like this.
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
SetEnvIf Origin "http(s)?://(prueba.miweb.com|www.miweb.com)$" AccessControlAllowOrigin=$0
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
</IfModule>
</FilesMatch>
EDIT: Or you can simply put everything under the same domain www.miprueba.com and you avoid setting headers.