Skip to content
Related Articles
Open in App
Not now

Related Articles

jQuery | get() Method

Improve Article
Save Article
Like Article
  • Last Updated : 01 Mar, 2019
Improve Article
Save Article
Like Article

In jQuery .get() method loads data from the server by using the GET HTTP request. This method returns XMLHttpRequest object.


$.get( url, [data], [callback], [type] )


  1. url : String containing the URL at which request is to be sent
  2. data : This is an optional parameter that represents key/value pairs that will be sent to the server.
  3. callback: This optional parameter represents the function which is to be executed whenever the data is loaded successfully.
  4. type : This parameter represents type of data to be returned to the callback function i.e “xml”, “script”, “json”, “html”, “html”, “jsonp”, or “text”.


  • This PHP code is use to get data when below html program send the HTTP GET request.

    // Result.php file
    if( $_REQUEST["name"] ) {
       $name = $_REQUEST['name'];
       echo "Welcome ". $name;


  • This HTML code is use to send the HTTP GET request.

        <script type="text/javascript"
        <script type="text/javascript"
            $(document).ready(function() {
            $("#driver").click(function(event) {
                     "result.php", {
                         name: "GFG"
                     function(data) {
        <p>Click on the button to load result file 
        <span id="stage" 
            <input type="button"
                   value="Load Data" />


  • Output:
    Before clicking on the button:

    After clicking on the button:

    My Personal Notes arrow_drop_up
    Like Article
    Save Article
    Related Articles

    Start Your Coding Journey Now!