Javascript jquery获取请求错误
我试图在用户输入一个值并将该值作为参数传递后发出get请求,但是什么也没有发生。Get函数外部的警报工作正常。这是我的密码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:
$(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中的控制台,应该会出现一些错误