ajax或jquery post json请求
我试图进行post-json调用,但它在develepers工具中显示了调用类型“text/html” 这是我的ajax和jquery调用,它们都发布了相同的调用ajax或jquery post json请求,jquery,ajax,post,Jquery,Ajax,Post,我试图进行post-json调用,但它在develepers工具中显示了调用类型“text/html” 这是我的ajax和jquery调用,它们都发布了相同的调用 var dataString='query='+search_value; $.ajax({ url: '/reports/search', type: 'post', dataType: 'json', data: da
var dataString='query='+search_value;
$.ajax({
url: '/reports/search',
type: 'post',
dataType: 'json',
data: dataString,
success:function(data){
console.log("success"+data);
}
});
jquery
$.post( "/reports/search", { query: search_value},function(data) {
console.log(data);
},"json");
这是请求的屏幕截图
我的要求怎么了
您必须定义基本URL或正确的URL来进行Ajax调用。这是因为响应(404)以文本/html的形式返回。首先更正URL,然后检查。此外,数据类型是您希望接收的,它不控制实际发送的内容。“我的请求有什么问题”
-您请求的是服务器找不到的资源:/reports/search
。URL错误或服务器上有问题。根据提供的信息,我们无法得知。
var dataString='query='+search_value;
$.ajax({
url: 'yourbase url'+'/reports/search',
type: 'post',