Simple Jquery ajax request example with demo

Simple Jquery ajax request example with demo

Today, We want to share with you Simple Jquery ajax request example.In this post we will show you jQuery Ajax GET and POST Requests, hear for asynchronous ajax call jquery example we will give you demo and example for implement.In this post, we will learn about Simple Ajax request example with JQuery and PHP with an example.

Simple Jquery ajax request example

There are the Following The simple About Jquery ajaxrequest example Full Information With Example and source code.

As I will cover this Post with live Working example to develop JAvascript Ajax Post Request Example in PHP server side, so the some major files and Directory structures for this example is following below.

  Vuejs Editable Grid component - GridView in Vue.JS

jquery POST and GET ajax json data

index.html

<html lang="en">
<head>
	<title>PHP JQuery Ajax Demo with Source code</title>
	<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
	<button class="ajax">Get Player Information(Virat Kohali)</button>
    <script type="text/javascript">
    	$(".ajax").click(function(){
		  $.ajax({
			url: "/api/get_player_history.php",
			dataType: "json",
			type: "POST",
			data: {"player_id":"12540058"},
			success: function (data) {
			  //alert(data);
			  console.log(data);
			},
			error: function() {
			  //alert('Error.');
			  console.log(Error);
			}
		  });
    	});
    </script>
</body>
</html>

jQuery ajax() Method

index.html

var player_id = $("ul.nav").first().attr("id");
var simple_request = $.ajax({
  url: "get_player_history.php",
  type: "POST",
  data: {id : player_id},
  dataType: "html"
});

simple_request.done(function(data) {
  $("#display_player_history").html( data.msg );
});

simple_request.fail(function(jqXHR, textStatus) {
  alert( "Request failed: " + textStatus );
});

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jquery ajax data.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

avatar
  Subscribe  
Notify of