Ajax Cross Domain Calls

前端 未结 3 760
半阙折子戏
半阙折子戏 2020-11-30 13:19

Can we make Ajax request to a different instance of server(different port) running on the same machine

3条回答
  •  北海茫月
    2020-11-30 13:44

    Different port means different domain for the browser. So you will hit the cross-domain barrier.

    Like Stuart said, you could try using JSONP.

    If you are using jQuery, I'd recommend http://code.google.com/p/jquery-jsonp/ if you want it to be as painless as possible.

提交回复
热议问题