仅在 jquery ajax 调用完全完成并且响应完全加载到浏览器中后,如何进行 js 函数调用。我正在尝试将 ajax 调用的响应加载到 div 标签中。
加载响应后,我想获取 ajax 调用响应中存在的图像的位置。使用该位置,我将在同一 div 标签中的图像之间画线。
问题是:在浏览器中完全呈现ajax响应之前,调用js函数并使用错误的位置绘制线条。
function loadMap(formId, url, divID)
{
event.preventDefault();
var values = $("#"+formId).serialize();
openDialog();
$.ajax({
url : url,
type : "post",
data : values,
async: false,
cache: false,
success : function(result)
{
closeDialog();
$("#"+divID).html(result);
},
error : function()
{
loadSessionExpiredPage();
},
});
alert("Ajax call Completed");
drawMap(); // Taking the position of images from response text and Draw lines in the div tag where a loaded the response text.
}