jquery  ajax get() and post() methods

jquery $.get() method

the jquery.get() method is used to load data from the server using a http get request.

the jquery get method syntax :-

        $.geturl, [data], [callback], type);
  • url        :- specifies the url you wish to request.
  • data     :- a plain object or string that is sent to the server with the request.
  • callback :- the optional callback parameter is the name of a function to be executed if the request succeeds.
  • type     :- the type of data expected from the server.

the jquery get method example


jquery $.post() method

the jquery.post() method is used to load data from the server using a http post request.

the jquery post method syntax :-

         $.posturl, [data], [callback], type);
  • url        :- containing the url to which the request is sent.
  • data     :- a plain object or string that is sent to the server with the request.
  • callback :- the optional callback parameter is the name of a function to be executed if the request succeeds.
  • type     :- the type of data expected from the server.

the jquery post method example