Home > Article > Web Front-end > How jquery implements ajax technology 3: $.get()
Today I want to introduce to you $.get() in jQuery. It also allows us to complete the ajax requirements in website development with a very small amount of code.
The parameters of the $.get() function are the same as the $.post() parameters we introduced in "How jquery implements ajax technology 2: $.post()". The details are as follows:
$.get(url,data,callback,type)
url---The URL address of the page to be loaded.
data---Key / value parameters to be sent.
callback---Callback function when loading is successful.
type---Return content format, xml, html, script, json, text, _default.
Here is a practical example:
============================================ =====================
ajax.html
$(document).ready(function(){
$('#bot_1').click(function(){
$.get('ajax.php',{web :"mysql100"},function(data,st){$("div").html(data);})
})
})
============ ================================================== =
ajax.php
echo 'The website you want to visit is'.$_GET['web'];
?>
The above is how jquery implements ajax technology 3: $.get (), please pay attention to the PHP Chinese website (www.php.cn) for more related content!