是否可能在另一个ajax请求内部发出ajax请求?
因为我需要从第一个ajax请求的一些数据,以进行下一个ajax请求。
因为我需要从第一个ajax请求的一些数据,以进行下一个ajax请求。
首先,我使用Google Maps API获取LAT& LNG,之后我使用LAT& LNG请求Instagram API(基于搜索的位置)。
再次,这是可能的,如果是如此?
$('input#search').click(function(e){
e.preventDefault();
var source=$('select[name=state] option:selected').text()+' '+$('select[name=city] option:selected').text()+' '+$('select[name=area] option:selected').text();
var source=source.replace(/ /g,'+');
if(working==false){
working=true;
$(this).replaceWith('<span id="big_loading"></span>');
$.ajax({
type:'POST',url:'/killtime_local/ajax/location/maps.json',dataType:'json',cache: false,data:'via=ajax&address='+source,success:function(results){
// this is where i get the latlng
}
});
} else {
alert('please,be patient!');
}
});
这里是一个例子:
$.ajax({
type: "post",url: "ajax/example.PHP",data: 'page=' + btn_page,success: function (data) {
var a = data; // This line shows error.
$.ajax({
type: "post",url: "example.PHP",data: 'page=' + a,success: function (data) {
}
});
}
});