【发布时间】:2017-11-06 01:47:43
【问题描述】:
我们的一位工程师刚刚将他的 iPad 带给我,并展示了我们网站上无法使用的功能。这适用于 Chrome 和 Firefox,但不适用于 iPhone 或 iPad。这是 3 个选择框,当您单击第一个中的值时,它会运行 ajax 并填充第二个选择框。
这是在 iOS 中不起作用的功能。
我们有点不知道从哪里开始测试。谁能提供一些关于从哪里开始调试的建议,或者你能看到我们做错了什么吗?
$().ready(function () {
$('.vehicle-search .make').bind('click', function (e) {
var makeId = $(e.target).val();
var container = $(e.target).parent('.vehicle-search');
if (parseInt(makeId) > 0) {
$.ajax({
url: site.internal.url + '/lib/ajax/vehicle/make/getModelList.php',
type: 'post',
dataType: 'json',
success: function (r) {
if (r.length > 0) {
$('.vehicle-search > .model').html('');
$('.vehicle-search > .year').html('');
var html = '';
for (var i = 0; i < r.length; i++) {
html += "<option value='"+r[i].id+"'>"+r[i].name+"</option>";
}
$('.vehicle-search > .model').html(html);
} else {
alert('We did not find any models for this make');
}
},
error: function () {
alert('Unable to process your request, ajax file not found');
return false;
},
data: {
makeId: makeId
}
});
} else {
$('.vehicle-search > .model').html('');
$('.vehicle-search > .year').html('');
}
});
........
【问题讨论】:
-
你试过 Safari/Windows 吗?
-
另外,到底是哪里出了问题?
-
只是不要复制帖子。可能这会有所帮助:stackoverflow.com/a/18514269/1872856
标签: javascript jquery