Có thể thực hiện yêu cầu ajax trong yêu cầu ajax khác không? vì tôi cần một số dữ liệu từ yêu cầu ajax đầu tiên để thực hiện yêu cầu ajax tiếp theo.Yêu cầu jQuery Ajax bên trong Yêu cầu Ajax
Trước tiên, tôi đang sử dụng API Google Maps để nhận LAT & LNG, sau đó tôi sử dụng LAT & LNG để yêu cầu API Instagram (vị trí dựa trên tìm kiếm).
Một lần nữa, điều này có thể thực hiện được không và nếu có thì làm cách nào?
$('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!');
}
});
Có nó có thể – Ved
bạn có thể post đoạn code bạn có cho đến nay. –
Tôi đã chỉnh sửa câu hỏi của mình, mã ở trên –