The php is inherited in to apache web server to echo the response stream with TCP connection client and server. The python is not inherited with Apache web server as php.So as response the output in standard like in command prompt,so python cant response the request from Ajax. Most of the language is supported to ajax ,because the web server executes the file. so python need webserver to run on it.And its done through CGI recently the MOD_PYTHON is used to run on server