Created
May 19, 2015 10:17
-
-
Save binmaocom/eba73d4314da3a304679 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
sleep(6); | |
$get_value[] = $_GET['variable1']; | |
$get_value[] = $_GET['variable2']; | |
echo json_encode($get_value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script> | |
jQuery(document).ready(function($){ | |
function loadXMLDoc(){ | |
$.ajax({ | |
url:'ajax-demo-get.php', | |
data:{ | |
variable1 : '1', | |
variable2 : '2' | |
} | |
}) | |
.done(function( msg ) { | |
console.log(jQuery.parseJSON(msg)); | |
}); | |
} | |
$('#load-more').click(function(){ | |
loadXMLDoc(); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h2>Let AJAX change this text</h2> | |
<p id="myDiv">Aenean vulputate eleifend tellus. Ut leo. Praesent adipiscing. In dui magna, posuere eget, vestibulum et, tempor auctor, justo...</p> | |
<button id="load-more" type="button" >Load more</button> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script> | |
jQuery(document).ready(function($){ | |
function loadXMLDoc(){ | |
$.ajax({ | |
url:'ajax_info.txt', | |
}) | |
.done(function( msg ) { | |
$("#myDiv").html( msg ); | |
$("#load-more").remove(); | |
}); | |
} | |
$('#load-more').on('click.redsand', function(){ | |
loadXMLDoc(); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h2>Let AJAX change this text</h2> | |
<p id="myDiv">Aenean vulputate eleifend tellus. Ut leo. Praesent adipiscing. In dui magna, posuere eget, vestibulum et, tempor auctor, justo...</p> | |
<button id="load-more" type="button" >Load more...</button> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aenean vulputate eleifend tellus. Ut leo. Praesent adipiscing. In dui magna, posuere eget, vestibulum et, tempor auctor, justo. Fusce commodo aliquam arcu. | |
Fusce a quam. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Fusce fermentum. Phasellus consectetuer vestibulum elit. Nunc nonummy metus. | |
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Nunc nulla. Vivamus elementum semper nisi. Praesent ac massa at ligula laoreet iaculis. Aliquam eu nunc. | |
Nunc nulla. Donec mollis hendrerit risus. Pellentesque auctor neque nec urna. Aenean imperdiet. Maecenas egestas arcu quis ligula mattis placerat. | |
In turpis. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Vivamus consectetuer hendrerit lacus. Donec vitae orci sed dolor rutrum auctor. Nunc sed turpis. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment