ajax保持返回错误而不是成功 [英] ajax keep return error instead of sucess

查看:91
本文介绍了ajax保持返回错误而不是成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 $( #year)。change(< span class =code-keyword> function ()
{
var id = $( this )。val();
$ .ajax({
url:' Servlet'
类型: get
dataType: json
async: false
cache: false
processData: false
data:id,
sucess: function (result){

alert(result);



},
e rror: function (req,err)
{
console .log(< span class =code-string>' 我的消息' + err);
}
});

return false ;
});







在上面的代码中,jQuery ajax调用不断给出错误没有成功。

如果您在此代码中发现任何问题,请查看并告诉我。



提前致谢。

解决方案

#year)。更改( function ()
{
var id =


this )。val();


.ajax({
url:< span class =code-string>' Servlet'
类型: get
dataType: json
async: false
cache: false
processData: false
data:id,
sucess: function (result){

alert(result);



},
错误:功能(req,err)
{
console .log(' my message' + err);
}
});

return false ;
});







在上面的代码中,jQuery ajax调用不断给出错误没有成功。

如果您在此代码中发现任何问题,请查看并告诉我。



提前致谢。


$("#year").change(function()
        {  
       	 var id = $(this).val();
        	$.ajax({
        	url:'Servlet',
        	type:"get",
        	dataType: "json",
        	async: false,
        	 cache: false,
        processData: false,  
        	data: id,
        	sucess: function(result) {
        
        	alert(result);
        	
        	
        	
        }, 	
        	error: function(req, err)
        	{ 
        	console.log('my message' + err); 
        	}
        	});
        	
        	return false;
        });




In the above code jQuery ajax call keeps on giving error and not success.
Please have a look and let me know if you find any issue in this code.

Thanks in advance.

解决方案

("#year").change(function() { var id =


(this).val();


.ajax({ url:'Servlet', type:"get", dataType: "json", async: false, cache: false, processData: false, data: id, sucess: function(result) { alert(result); }, error: function(req, err) { console.log('my message' + err); } }); return false; });




In the above code jQuery ajax call keeps on giving error and not success.
Please have a look and let me know if you find any issue in this code.

Thanks in advance.


这篇关于ajax保持返回错误而不是成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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