Javascript jquerypost>;成功不会触发
我对jquery的PostAPI有问题Javascript jquerypost>;成功不会触发,javascript,jquery,jquery-post,Javascript,Jquery,Jquery Post,我对jquery的PostAPI有问题 $(".MGdi").click(function () { id=$(this).attr("rel") $.post( 'Mdeger.asp?cmd=MG', { id: id, drm: $(this).html()} , function( data ) { var $response=$(data); var snc = $response.find(
$(".MGdi").click(function () {
id=$(this).attr("rel")
$.post( 'Mdeger.asp?cmd=MG', { id: id, drm: $(this).html()} ,
function( data ) {
var $response=$(data);
var snc = $response.find('#snc').html();
alert(snc);
},"application/x-www-form-urlencoded");
});
另一种方式是:
$(".Pasif").click(function () {
id=$(this).attr("rel")
$.post( 'Mdeger.asp?cmd=Pasif', { id: id, drm: $(this).html()} ,
function( data ) {
$(this).html(data);
alert(data)
},"application/x-www-form-urlencoded");
});
服务器端一切正常,但客户端的success函数没有任何作用。
即使是基本代码,如
警报(“hoho”)
;未触发成功。这通常发生在无法解析响应时。您应该使用firebug或类似的调试工具检查响应
特别是那些需要json数据的方法,严格地验证响应,如果有任何无效的响应,它什么也不做,没有错误,没有警告,没有异常
当您的回调函数没有运行时,您应该怀疑您的响应不正确
//蒂尔凯泽特
乌赞·拉夫·科萨斯德·德埃林德·贝尔斯利克·瓦尔萨·德努克·方克西约努萨·马亚卡克特。sunucudan gelen değerleri Iyce kontrol etmekte fayda var.jquery dönşdeğerinde veya dönşfonksiyonunda bir hata olursa seni uyarmadan işi sonlandırıyor.我也有这个问题。事实证明,我对同一个域进行了AJAX调用,但调用的端口不同,这在Javascript中是不允许的(出于安全原因) 有关更多信息,请参阅此相关问题:
我非常惊讶AJAX调用将POST/GET发送到服务器(我可以通过查看服务器日志来验证这一点),但响应从未被读取。我本以为发送和接收都是不允许的。我也有这个错误,这是一个愚蠢的问题:我在JS中将数据类型设置为“json”,但调用的页面返回纯HTML。这将导致根本不启动success函数。我找不到任何解决方案,但如果您有类似的问题,我建议使用jax:)