All ajax is executed and the page is loaded.
jquery ajax&load method causes the js effect not to be displayed or the effect error occurs due to ajax relayout of the page after loading.
Solution: You need to execute the method after ajax get post or load is completed to avoid final errors caused by their incomplete execution.
Then first look at the load method definition:
jQuery ajax - load() 方法 jQuery Ajax 参考手册 实例 使用 AJAX 请求来改变 p 元素的文本: $("button").click(function(){ $("p").load('demo_ajax_load.txt'); }); 亲自试一试 您可以在页面底部找到更多 TIY 实例 定义和用法 load() 方法通过 AJAX 请求从服务器加载数据,并把返回的数据放置到指定的元素中。 注释:还存在一个名为 load 的 jQuery 事件方法。调用哪个,取决于参数。 语法 load(url,data,function(response,status,xhr)) 参数 描述 url 规定要将请求发送到哪个 URL。 data 可选。规定连同请求发送到服务器的数据。 function(response,status,xhr) 可选。规定当请求完成时运行的函数。 额外的参数: response - 包含来自请求的结果数据 status - 包含请求的状态("success", "notmodified", "error", "timeout" 或 "parsererror") xhr - 包含 XMLHttpRequest 对象 详细说明 该方法是最简单的从服务器获取数据的方法。它几乎与 $.get(url, data, success) 等价,不同的是它不是全局函数,并且它拥有隐式的回调函数。当侦测到成功的响应时(比如,当 textStatus 为 "success" 或 "notmodified" 时),.load() 将匹配元素的 HTML 内容设置为返回的数据。这意味着该方法的大多数使用会非常简单: $("#result").load("ajax/test.html"); 如果提供回调函数,则会在执行 post-processing 之后执行该函数: $("#result").load("ajax/test.html", function() { alert("Load was performed."); }); 上面的两个例子中,如果当前文档不包含 "result" ID,则不会执行 .load() 方法。 如果提供的数据是对象,则使用 POST 方法;否则使用 GET 方法。 加载页面片段 .load() 方法,与 $.get() 不同,允许我们规定要插入的远程文档的某个部分。这一点是通过 url 参数的特殊语法实现的。如果该字符串中包含一个或多个空格,紧接第一个空格的字符串则是决定所加载内容的 jQuery 选择器。 我们可以修改上面的例子,这样就可以使用所获得文档的某部分: $("#result").load("ajax/test.html #container"); 如果执行该方法,则会取回 ajax/test.html 的内容,不过然后,jQuery 会解析被返回的文档,来查找带有容器 ID 的元素。该元素,连同其内容,会被插入带有结果 ID 的元素中,所取回文档的其余部分会被丢弃。 jQuery 使用浏览器的 .innerHTML 属性来解析被取回的文档,并把它插入当前文档。在此过程中,浏览器常会从文档中过滤掉元素,比如 <html>, <title> 或 <head> 元素。结果是,由 .load() 取回的元素可能与由浏览器直接取回的文档不完全相同。 注释:由于浏览器安全方面的限制,大多数 "Ajax" 请求遵守同源策略;请求无法从不同的域、子域或协议成功地取回数据。 更多实例 例子 1 加载 feeds.html 文件内容: $("#feeds").load("feeds.html"); 例子 2 与上面的实例类似,但是以 POST 形式发送附加参数并在成功时显示信息: $("#feeds").load("feeds.php", {limit: 25}, function(){ alert("The last 25 entries in the feed have been loaded"); }); 例子 3 加载文章侧边栏导航部分至一个无序列表: HTML 代码: <b>jQuery Links:</b> <ul id="links"></ul> jQuery 代码: $("#links").load("/Main_Page #p-Getting-Started li");
I found that there is a callback method, that’s great. If I write my own method in the callback, it will be executed after ajax. Ever since:
$("#feeds").load("feeds.php", function(){ fun(); });
But there is a problem, what if there are more than one? Add after each one? It also determines whether this method has been executed. (...)
So: Find a jquery built-in judgment and then execute it after all is completed, then:
$("p").ajaxStop(function(){ if (hash && !isGlobalHash) { $("#MfTit"+hash).trigger("click"); isGlobalHash = true; } });
Definition:
Example
When all AJAX requests are completed, a prompt box is triggered:
$("p").ajaxStop(function(){ alert("所有 AJAX 请求已完成"); });
Of course, if there is a stop, there will be a start.
The above is the detailed content of All ajax is executed and the page is loaded.. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Want to copy a page in Microsoft Word and keep the formatting intact? This is a smart idea because duplicating pages in Word can be a useful time-saving technique when you want to create multiple copies of a specific document layout or format. This guide will walk you through the step-by-step process of copying pages in Word, whether you are creating a template or copying a specific page in a document. These simple instructions are designed to help you easily recreate your page without having to start from scratch. Why copy pages in Microsoft Word? There are several reasons why copying pages in Word is very beneficial: When you have a document with a specific layout or format that you want to copy. Unlike recreating the entire page from scratch
![Error loading plugin in Illustrator [Fixed]](https://img.php.cn/upload/article/000/465/014/170831522770626.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
When launching Adobe Illustrator, does a message about an error loading the plug-in pop up? Some Illustrator users have encountered this error when opening the application. The message is followed by a list of problematic plugins. This error message indicates that there is a problem with the installed plug-in, but it may also be caused by other reasons such as a damaged Visual C++ DLL file or a damaged preference file. If you encounter this error, we will guide you in this article to fix the problem, so continue reading below. Error loading plug-in in Illustrator If you receive an "Error loading plug-in" error message when trying to launch Adobe Illustrator, you can use the following: As an administrator

Subtitles not working on Stremio on your Windows PC? Some Stremio users reported that subtitles were not displayed in the videos. Many users reported encountering an error message that said "Error loading subtitles." Here is the full error message that appears with this error: An error occurred while loading subtitles Failed to load subtitles: This could be a problem with the plugin you are using or your network. As the error message says, it could be your internet connection that is causing the error. So please check your network connection and make sure your internet is working properly. Apart from this, there could be other reasons behind this error, including conflicting subtitles add-on, unsupported subtitles for specific video content, and outdated Stremio app. like

Title: Methods and code examples to resolve 403 errors in jQuery AJAX requests. The 403 error refers to a request that the server prohibits access to a resource. This error usually occurs because the request lacks permissions or is rejected by the server. When making jQueryAJAX requests, you sometimes encounter this situation. This article will introduce how to solve this problem and provide code examples. Solution: Check permissions: First ensure that the requested URL address is correct and verify that you have sufficient permissions to access the resource.

jQuery is a popular JavaScript library used to simplify client-side development. AJAX is a technology that sends asynchronous requests and interacts with the server without reloading the entire web page. However, when using jQuery to make AJAX requests, you sometimes encounter 403 errors. 403 errors are usually server-denied access errors, possibly due to security policy or permission issues. In this article, we will discuss how to resolve jQueryAJAX request encountering 403 error

Page refresh is very common in our daily network use. When we visit a web page, we sometimes encounter some problems, such as the web page not loading or displaying abnormally, etc. At this time, we usually choose to refresh the page to solve the problem, so how to refresh the page quickly? Let’s discuss the shortcut keys for page refresh. The page refresh shortcut key is a method to quickly refresh the current web page through keyboard operations. In different operating systems and browsers, the shortcut keys for page refresh may be different. Below we use the common W

If you encounter freezing issues when inserting hyperlinks into Outlook, it may be due to unstable network connections, old Outlook versions, interference from antivirus software, or add-in conflicts. These factors may cause Outlook to fail to handle hyperlink operations properly. Fix Outlook freezes when inserting hyperlinks Use the following fixes to fix Outlook freezes when inserting hyperlinks: Check installed add-ins Update Outlook Temporarily disable your antivirus software and then try creating a new user profile Fix Office apps Program Uninstall and reinstall Office Let’s get started. 1] Check the installed add-ins. It may be that an add-in installed in Outlook is causing the problem.

Title: Implementation method of page jump in 3 seconds: PHP Programming Guide In web development, page jump is a common operation. Generally, we use meta tags in HTML or JavaScript methods to jump to pages. However, in some specific cases, we need to perform page jumps on the server side. This article will introduce how to use PHP programming to implement a function that automatically jumps to a specified page within 3 seconds, and will also give specific code examples. The basic principle of page jump using PHP. PHP is a kind of
