


Detailed explanation of jQuery's $.getScript method to load javaScript documents
Dec 23, 2017 am 10:50 AMThis article mainly brings you an article based on jQuery's $.getScript method to load javaScript document parsing. The editor thinks it is quite good, so I will share it with you now and give it as a reference. I hope it can help everyone.
1. The codes of the two files are as follows:
<script> function?Ajax(){??//將9-4.html中的Ajax()函數(shù)進(jìn)行修改 ?$.getScript('9-8.js',function(data){ ?var?html?="<table border='1' cellpadding='2'>"; ?$.each(comments,?function(Index,?comment)?{ ???html?+=?'<tr><td>'?+?comment.username?+?':</td><td>'?+?comment['content']?+?'</td></tr>'; ?})????//comment['username']也可寫(xiě)成comment.username ?html?+="</table>" //alert("Hello"); $("#target").html(html); ???}?? ?); } </script> <input type="button" value="Ajax提交" onclick="Ajax();" /> <p id="target"></p>
2.
comment is an object.
comments?是個(gè)數(shù)組 comment?是個(gè)對(duì)象。 我也是這樣認(rèn)為的。 是不是對(duì)于json對(duì)象,引用其屬性有兩種方式,即comment.attribute或者comment['attribute']。 但是一般的對(duì)象,引用其屬性好像只能是comment.attribute這種形式吧。 我不知道對(duì)于json對(duì)象還可以這樣引用comment['attribute']。我以為這樣就是數(shù)組了。 這就是json區(qū)別于數(shù)組的地方,自有它的特殊性。Related recommendations:
javaScript and jQuery implement automatic loading
javascript loads and runs js method in order_javascript skills
jQuery loads an html page into the specified div
The above is the detailed content of Detailed explanation of jQuery's $.getScript method to load javaScript documents. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages ??and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on ??the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

The relationship between js and vue: 1. JS as the cornerstone of Web development; 2. The rise of Vue.js as a front-end framework; 3. The complementary relationship between JS and Vue; 4. The practical application of JS and Vue.

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

jQuery is a popular JavaScript library that is widely used to handle DOM manipulation and event handling in web pages. In jQuery, the eq() method is used to select elements at a specified index position. The specific usage and application scenarios are as follows. In jQuery, the eq() method selects the element at a specified index position. Index positions start counting from 0, i.e. the index of the first element is 0, the index of the second element is 1, and so on. The syntax of the eq() method is as follows: $("s

jQuery is a popular JavaScript library widely used in web development. During web development, it is often necessary to dynamically add new rows to tables through JavaScript. This article will introduce how to use jQuery to add new rows to a table, and provide specific code examples. First, we need to introduce the jQuery library into the HTML page. The jQuery library can be introduced in the tag through the following code:
