get()
is a built-in method in jQuery that is used to retrieve data from the server using the HTTP GET request.
$.get(url, [data], function, datatype)
url
: URL of the server.[data]
: List of data items sent to the server along with the request. It is optional.function
: This function is called when the get()
request is successful. It is optional.datatype
: The type of data expected from the server. It is optional.In the code below, we have used the $(selector).click()
function to fire the event on the button click. The message pops up when the button is pressed.
Include this library for jQuery:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">