Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/449.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery获取请求错误_Javascript_Jquery_Ajax_Html - Fatal编程技术网

Javascript jquery获取请求错误

Javascript jquery获取请求错误,javascript,jquery,ajax,html,Javascript,Jquery,Ajax,Html,我试图在用户输入一个值并将该值作为参数传递后发出get请求,但是什么也没有发生。Get函数外部的警报工作正常。这是我的密码 $(document).ready(function(){ $( "input[type='text']" ).change(function() { $.get("http://example.com/get.php?number=1234", function(data, status){ alert("Data: " + data + "\nStatus:

我试图在用户输入一个值并将该值作为参数传递后发出get请求,但是什么也没有发生。Get函数外部的警报工作正常。这是我的密码

 $(document).ready(function(){
$( "input[type='text']" ).change(function() {

$.get("http://example.com/get.php?number=1234", function(data, status){
    alert("Data: " + data + "\nStatus: " + status);
    $("#result").html( data );
});
alert("end of script");

     });
    });

要将参数发送到
get.php
,需要附加查询字符串


在您的
$中。在URL后获取
,添加
?参数=值
,并相应地更改值

我认为您这里有一个跨来源的问题。基本上,如果您试图加载的资源与请求的来源位于不同的域中,它将不允许您访问它

检查Google Chrome中的控制台,应该会出现一些错误