Let the storm money come!

jquery get()

    

 

Get

DISAMBIGUATION

It can be:

  • .get() DOM manipulation, or
  • $.get() data transfer method

CONTENTS


$.GET() - DATA TRANSFER METHOD

Load a remote page using an HTTP GET request

Reference

Example

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);
});

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'


.GET() - DOM MANIPULATION

Gets elements specified or creates an array with the matching elements to be used as selectors.

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'
主要是这两种方法,操作表单和一个 ajax 请求,get 操作表单,是取一组集合中的某一个,这个集合可以是任何对象。
posted @ 2010-06-22 00:15  精密~顽石  阅读(692)  评论(0编辑  收藏  举报
在通往地狱的路上,加班能使你更快到达。