Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function(){
- $('#getUser').on('click',function(){
- var user_id = $('#user_id').val();
- $.ajax({
- type:'POST',
- url:'test.php',
- dataType: "json",
- data:{user_id:user_id},
- success:function(data){
- if(data.status == 'ok'){
- $('#userName').text(data.result);
- $('.user-content').slideDown();
- }else{
- alert("User not found...");
- }
- }
- });
- });
- });
- <input type="text" id="user_id" />
- <input type="button" id="getUser" value="Get Details"/>
- <div class="user-content" style="display: none;">
- <h4>User Details</h4>
- <p>Name: <span id="userName"></span></p>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement