你可以做这样的事情。
function findIdealPoints(data){ var i = 0; while (i < data.length){ loadAspectWithinRange('aspect', data[i]['lat'], data[i]['long'], 10, compareWithAspect); i++;}不必为每次出现都进行Ajax调用,而是将数据对象发送到您的调用中
loadAspectWithinRange('aspect',data,10,compareWithAspect)然后,在Ajax请求中,将对象数组发送到您的服务,并检索所有对象的结果,而不是一一对应。
$.ajax({ url:"...", data:{ attr1:'aspect', points: data(here is the array retrieved from "getIdealData.php") attr2: 10 }, success:function(data){ compareWithAspect(data) }})在服务器端处理中,为这些
getIdealData.php点上的所有元素构建一个对象数组。
而不是为每个元素都做一个Ajax会更好



