如何在 ajax 成功函数上加载另一个页面



我需要在ajax成功函数上加载另一个页面。

我有两个文件,即file1file2。在file1 ajax 成功函数加载file2 .

在 JavaScript 中用于重定向使用

window.location.href ="http://google.com";

或在jquery中使用.load()

$( "#result" ).load( "ajax/test.html" );

http://api.jquery.com/load/

您可以使用 iframe 加载任何其他页面内容。

创建一个 iframe 并赋予它 css ' display:none; '。然后在成功函数中调用 ajax 时执行以下操作:

$('iframe').attr('src', yoururl)
$('iframe').show();

相关内容