私はAjaxコードがリモートスクリプト(http://leke.dyndns.org)としてではなく、他のドメインで同じドメイン内の仕組み来る...サーバー側のコードが別のドメインでホストされている場合、ajaxが実行されますか?
function ajaxRequest()
{
var xmlhttp;
var domainName = location.host;
var url = 'http://leke.dyndns.org/cgi/dn2ipa/resolve-dns.py?domainName=';
url = url + domainName + '&x=' + Math.random(); // x= to avoid browser caching;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert(domainName+'='+xmlhttp.responseText);
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
ajaxRequest();
(Firefoxのスクラッチパッドをオープンし、入力されましたhttp://stackoverflow.comのように)?
それが助け場合は、ここではCGI側はある...
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os, cgi, cgitb, socket
cgitb.enable()
cgiData = cgi.FieldStorage() # Domain Name
domainName = cgiData.getvalue('domainName')
ipa = socket.gethostbyaddr(domainName)
sendIpa = ipa[2][0]
print 'Content-Type: text/html;charset=utf-8'
print ""
print sendIpa
http://stackoverflow.com/questions/466737/why-is-cross-domain-ajax-a-security-concern –