Home > Web Front-end > JS Tutorial > jQuery combined with ajax to dynamically load text content_jquery

jQuery combined with ajax to dynamically load text content_jquery

WBOY
Release: 2016-05-16 15:58:19
Original
1232 people have browsed it

The ajax() method loads remote data through HTTP requests.

This method is the underlying AJAX implementation of jQuery. For simple and easy-to-use high-level implementations, see $.get, $.post, etc. $.ajax() returns the XMLHttpRequest object it created. In most cases you won't need to manipulate this function directly unless you need to manipulate less commonly used options for more flexibility.

In the simplest case, $.ajax() can be used directly without any parameters.

Load a text via AJAX:

jQuery code:

$(document).ready(function(){
 $("#b01").click(function(){
 htmlobj=$.ajax({url:"/jquery/test1.txt",async:false});
 $("#myDiv").html(htmlobj.responseText);
 });
});
Copy after login

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template