jquery get()
Get
[edit]
DISAMBIGUATION
It can be:
- .get() DOM manipulation, or
- $.get() data transfer method
CONTENTS |
[edit]
$.GET() - DATA TRANSFER METHOD
Load a remote page using an HTTP GET request
[edit]
Reference
[edit]
Example
[edit]
Front-end
jQuery returns the content of the page you are sending the data to using a callback function:
jQuery:
$.get("remote_file_path", {"param":"param value"}, function(returned_data) { alert(returned_data); });
[edit]
PHP code example
At the back-end:
<?php echo 'Welcome '.$_GET['param']; ?>
OUTPUT: Browser will alert, with it's standard pop-up box 'Welcome param value'
[edit]
.GET() - DOM MANIPULATION
Gets elements specified or creates an array with the matching elements to be used as selectors.
[edit]
Example
jQuery:
var _li=$('ul li').get(0); // get first element alert($(_li).html()); // print element content
HTML:
<ul> <li>Hello</li> <li>Aloha</li> </ul>
OUTPUT:
Browser will alert, with its standard pop-up box 'Hello'
走向地狱的途中,不小心走了程序员这条路,路上一个个黑心的老板,和暗无天日的加班,我才发现,通往地狱的路径中,我们这行是最短的。