Home > Article > Web Front-end > jQuery combined with ajax to dynamically load text content_jquery
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); }); });
The above is the entire content of this article, I hope you all like it.