android browser ajax,ajax - jQuery(.Mobile) not firing properly in Android browser - Stack Overflow

博主在使用jQuery的AJAX和GET方法从inc/check_stid.inc.php获取数据时,发现代码在桌面浏览器正常,但在Android浏览器上出现延迟并报错。问题似乎局限于Android环境,寻求解决移动端AJAX问题的线索。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

jQuery code:

$.ajaxSetup({ cache: false });

$('#stid_status_msg').hide();

$('.SpeedTestId').blur(function(e) {

e.preventDefault();

var stid = $('.SpeedTestId').val();

var postString = 'stid=' + stid;

/* $.ajax({

cache: false,

url:"inc/check_stid.inc.php",

type:'POST',

data:postString,

success:function(msg) {

$('#stid_status_msg').html(msg);

$('#stid_status_msg').show();

},

error:function(error) {

$('#stid_status_msg').html('Error submitting results!' + error + '');

$('#stid_status_msg').show();

}

});*/

$.get("inc/check_stid.inc.php", { stid: stid }, function(msg) {

$('#stid_status_msg').html(msg);

$('#stid_status_msg').show();

});

});

The commented out $.ajax() method is what I was trying originally, but quickly discovered $.get() was a better method for what I was trying to do. But regardless of which method I use the code works fine in desktop browsers (FF,IE,Chrome), but does not complete successfully in the Android browser.

When I use $.ajax(), and I test in the Android browser it first hangs for several seconds, and then the error callback fires and I get:

Error submitting results! [object][object]

I should also note that when I enable the java console in the Android browser, it does not indicate any errors with the JS.

So it occurs to me that the script is not able to find/load inc/check_stid.inc.php for some reason. But why only in the Android browser?

Obviously I'm a jQuery newbie, and I appreciate any insight you folks can provide.

Edit

I installed FF on my android and the code works fine there as well. Whatever I am encountering is specific to the android browser. Very strange!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值