title: The console hint that net::ERR_CONNECTION_RES
body: <p><a href="http://i.stack.imgur.com/jzQEj.png" rel="nofollow">This is the screenshot of the video .</a>#   This little program serves as a server. I make it with python.</p>
  
  <pre><code>import socket
  
  
  def RunServer(environ, start_response):
      start_response=('200 OK',[('Content-Type','application/x-javascript')])
      data = "callback({name:'Eric',age:20,gender:'men'})"
      return data
  
  HOST = '127.0.0.1'  
  PORT = 80
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.bind((HOST, PORT))
  s.listen(1)
  print 'The server is listening'
  conn,addr = s.accept()
  print 'The server is connected by', addr
  conn.sendall(RunServer(111,11))
  while True:
      print '123'
  </code></pre>
  
  <h1>Ajax . the function of  this code is to request the information we need.</h1>
  
  <p>But when I ran the program , there is nothing wrong with the server. And the server did response and send the message which was data. So I believe the main problem is that I must have made a mistake when I use Ajax.</p>
  
  <pre><code>$(function(){
              $('#request').click(function(){
                      $.ajax({
                          type:'POST',
                          url:'http://127.0.0.1:80',
                          cache: false,
                          async: true,
                          dataType: 'jsonp',
                          jsonpCallback: 'callback',
                          success:function(data){
                              alert('123');
                              $('#result').append(data.name);
                          }
                          });
              })
              function callback(arg){
                  alert(arg);
                  return arg;
              }
  
  
          } )
  </code></pre>
  
  <h1>solution</h1>
  
  <h2>server.py</h2>
  
  <pre><code>from wsgiref.simple_server import make_server
  import application
  
  httpd = make_server('127.0.0.1',80,application.RunServer)
  print "Serving HTTP on port 80..."
  httpd.serve_forever() 
  </code></pre>
  
  <h2>application.py</h2>
  
  <pre><code>def RunServer(environ, start_response):
      start_response('200 OK',[('Content-Type','application/x-javascript')])
      data = "callback({name:'Eric',age:20,gender:'men'});"
      return data
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/aE8WR.png" rel="nofollow">enter image description here</a></p>