Tuesday, March 1, 2022

api calls using fetch

fetch('https://jsonplaceholder.typicode.com/users')

            .then(res => res.json())

            .then(json => console.log(json))

            .catch(err => console.error('Error:', err));

            

Thursday, August 12, 2021

Media Query

 <!doctype html>

<html lang="en">

  <head>

    <title>media query</title>

    <!-- Required meta tags -->

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">


    <!-- Bootstrap CSS -->

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">


    <style>

        @media only screen and (max-width:600px) {

            .tp{

                background-color: red;

            }

        }

        @media only screen and (min-width:600px) {

            .tp{

                background-color: green;

            }

        }

        @media only screen and (min-width:768) {

            .tp{

                background-color: blue;

            }

        }

        @media only screen and (max-width:992) {

            .tp{

                background-color: pink;

            }

        }

        @media only screen and (min-width:1200) {

            .tp{

                background-color: yellow;

            }

        }

    </style>


  </head>

  <body>

      <div class="tp h-50 w-50">

        test media query

      </div>

    <!-- Optional JavaScript -->

    <!-- jQuery first, then Popper.js, then Bootstrap JS -->

    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>

    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

  </body>

</html>


Thursday, July 15, 2021

ajax

 $.ajax({

url : ".php file path.php",

method : "POST",

data : JSON.stringify(param),

success : function(res){

res = JSON.parse(res);

if(res.result == 200)

{

//

}

}

}).fail(function(){

//

});

xhttp request

//Kirtishil Patil

var xhttp = new XMLHttpRequest();

xhttp.open("POST", "filename with complete path.php", true);

xhttp.onreadystatechange = function() {

    if (this.readyState == 4 && this.status == 200) {

        var res = this.responseText;

        var res_arry = JSON.parse(res);

        if (res_arry["result"] == 200) {

            //write here

        } else {

            //write here

        }

    }

};

var param = {//write param here};

xhttp.send(JSON.stringify(param));

Tuesday, July 13, 2021

Modal events

 <script>

  $("#my_modal").on('show.bs.modal',function(){

//before modal open

  })

  $("#my_modal").on('shown.bs.modal',function(){

//after modal open   

  })

  $("#my_modal").on('hide.bs.modal',function(){

//before modal close

  })

  $("#my_modal").on('hidden.bs.modal',function(){

//after modal close   

  })

</script>

Kirtishil Patil