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
& with ajax if click on button it gets var name from file & result is abc.
let us another example of ajax
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.
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 <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" />
& 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',
});
});
$('.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.