Ajax - networkstatus "pending"
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$(document).on("change", ".regions", function(e) {
$(".loading-div").show();
pp = $("#reg1").val();
r = $(this).attr("data-field"), o = $(this).val(), iso = $("option:selected", this).attr("iso"), "region1" == r && "region2" != r ? ($(".regions.district.adcatselect").html('<option value="" selected="SELECTED"><?=$_SESSION['def']['CHOOSE_CITY']?></option>'), $.ajax({
type: "POST",
url: "<?=HTML_ROOT?>inc/region2select.php?time=<?=time()?>",
data: {
region1Url: o
},
dataType: "html",
encode: !0
}).done(function(t) {
// laad iso
$("#iso").val(iso);
$(".loading-div").hide(), $(".regions.city").html(t)
})) : "region2" == r && "region1" != r ? ($(".regions.district.adcatselect").val(null), $.ajax({
type: "POST",
url: "<?=HTML_ROOT?>inc/region3select.php?time=<?=time()?>",
data: {
region2Url: "" + o,region1Url:pp
},
dataType: "html",
encode: !0
}).done(function(t) {
$(".regions.district").html(t),$(".loading-div").show(), $.ajax({
type: "POST",
url: "<?=HTML_ROOT?>inc/latlngselect.php?time=<?=time()?>",
data: {
region2Url: "" + o,region1Url:pp
},
dataType: "json",
encode: !0
}).done(function(t) {
//alert(t);
ca = t.split(' ');
$(".loading-div").hide(),$("#lat").val(ca[1]), $("#lng").val(ca[0])
}), $(".loading-div").hide()
})) : "region3" == r && $.ajax({ // lnglat van reg3
type: "POST",
url: "<?=HTML_ROOT?>inc/latlngselect.php",
data: {
region3Url: o,
region1Url:pp,
region2Url: $(".regions.city").val()
},
dataType: "json",
encode: !0
}).done(function(rt) {
//alert(rt);
caa = rt.split(' ');
$(".loading-div").hide(),$("#lat").val(caa[1]), $("#lng").val(caa[0])
});
})
$(".loading-div").show();
pp = $("#reg1").val();
r = $(this).attr("data-field"), o = $(this).val(), iso = $("option:selected", this).attr("iso"), "region1" == r && "region2" != r ? ($(".regions.district.adcatselect").html('<option value="" selected="SELECTED"><?=$_SESSION['def']['CHOOSE_CITY']?></option>'), $.ajax({
type: "POST",
url: "<?=HTML_ROOT?>inc/region2select.php?time=<?=time()?>",
data: {
region1Url: o
},
dataType: "html",
encode: !0
}).done(function(t) {
// laad iso
$("#iso").val(iso);
$(".loading-div").hide(), $(".regions.city").html(t)
})) : "region2" == r && "region1" != r ? ($(".regions.district.adcatselect").val(null), $.ajax({
type: "POST",
url: "<?=HTML_ROOT?>inc/region3select.php?time=<?=time()?>",
data: {
region2Url: "" + o,region1Url:pp
},
dataType: "html",
encode: !0
}).done(function(t) {
$(".regions.district").html(t),$(".loading-div").show(), $.ajax({
type: "POST",
url: "<?=HTML_ROOT?>inc/latlngselect.php?time=<?=time()?>",
data: {
region2Url: "" + o,region1Url:pp
},
dataType: "json",
encode: !0
}).done(function(t) {
//alert(t);
ca = t.split(' ');
$(".loading-div").hide(),$("#lat").val(ca[1]), $("#lng").val(ca[0])
}), $(".loading-div").hide()
})) : "region3" == r && $.ajax({ // lnglat van reg3
type: "POST",
url: "<?=HTML_ROOT?>inc/latlngselect.php",
data: {
region3Url: o,
region1Url:pp,
region2Url: $(".regions.city").val()
},
dataType: "json",
encode: !0
}).done(function(rt) {
//alert(rt);
caa = rt.split(' ');
$(".loading-div").hide(),$("#lat").val(caa[1]), $("#lng").val(caa[0])
});
})
Deze loopt hij meestal op vast:
Dus het is de ene call na de andere.
Hoe kan ik dit soepel laten verlopen?
Er zijn nog geen reacties op dit bericht.