abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

4/13/2018

Jquery & AJAX connectivity, working of jquery with ajax











hi everyone,
today i am going to show you next learning session which depends on jquery & ajax(asynchrnous javascript) & connectivity.

for this let see below example


eg:
      <script type = "text/javascript"
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
       
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $("#sampl").click(function(event){
               var name = $("#name").val();
               $("#abc").load('/jquery/abc.php', {"name":name} );
            });
         });
      </script>
   </head>
   
   <body>
      <p>Enter your name and click on the button:</p>
      <input type = "input" id = "name" size = "400" /><br />
       
      <div id = "abc" style = "background-color:00ccff;">
        
      </div>
       
      <input type = "button" id = "sampl" value = "check if value" />

above example load an abc.php file
& with ajax if click on button it gets var name from file & result is abc.


let us another example  of ajax

$('.btn').click(function() {
 
  $('.text').text('loading . . .');
 
  $.ajax({
    type:"GET",
    url:"abc.com",
    success: function(data) {
      $('.text').text(JSON.stringify(data));
    },
    dataType: 'jsonp',
  });
 
});

if click on button current value of text div get & replace with loading text.
in this exmple also use jsonp & from this url whatever data , get it string.


above exmple
uses,
stringify, jsonp , get method, sucess funciton & follow url , button click funtion.
so this good & pretty simple exmple to learn .


we will continue detail in next session.

thanks for viewing blog, share with friends & all.





An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...