是否有可能在一个Ajax调用指定端口 [英] Is it possible to specify a port in a ajax call

查看:478
本文介绍了是否有可能在一个Ajax调用指定端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用jQuery来运行特定的端口上的一个AJAX查询:

I'm trying to use jQuery to run an AJAX query on a specific port:

$(document).ready(function() {
        $.ajax({
        url: "http://test_serve:666/test.php",

        type: "GET",
        data: ({value_test: 'true'}),
        dataType: "html"

    });
})

这不工作:没有AJAX调用时,我没有得到萤火虫任何异常。 它不工作,如果我不指定端口。没有人知道为什么?

This doesn't work: no AJAX call is made and I don't get any exceptions in Firebug. It does work if I don't specify the port. Does anyone know why?

推荐答案

这是行不通的,由于该相同原产地政策。 AJAX请求只允许在同一个域中,协议和端口。

It doesn't work due the Same origin policy. AJAX requests are allowed only in the same domain, protocol and port.

如果你真的需要从源获取数据,你应该期待JSONP。

If you really need to get data from that source, you should look forward to JSONP.

这篇关于是否有可能在一个Ajax调用指定端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆