本文共 424 字,大约阅读时间需要 1 分钟。
跨域请求的解决方案。
$.ajax({
dataType: 'JSONP', type: "GET", url: "http://dzd.wddcn.com/vshop/addr.html?action=region&level=3&value=" + district.value, success: function (tjson) { if (region_cb) { region_cb('t', tjson); } for (var i = 0; i < tjson.length; i++) { town.options.add(new Option(tjson[i].name, tjson[i].id)); } if (arr.length > 3 && arr[3] != "" && arr[3] != "-1") { town.value = arr[3]; } } });如果用ajax请求type改成JSONP就可以了。
转载地址:http://ajjfk.baihongyu.com/