Code Monkey home page Code Monkey logo

teslablogger_client's Introduction


1. TeslaBlogger adinda bir blank solution açilir.

2. ASP.NET Core 3.1 Web Application (MVC) projesi eklenir.

	2.1. Views->Home klasorunun icindeki Index view'a request aticagimiz api için ajax ile Get() fonksiyonu yazilir ve gelen verileri dolduracagimiz html kodlari yazilir.

	<div class=" row">
    <div class=" col-sm-12">
        <div class=" card">
            <div class="card-header">
                <h3 class="card-title">List of Article About Tesla</h3>
            </div>
            <div class="card-header">
                <input type="button" value="List of Article" class="btn btn-block btn-primary" onclick="Get()" />
            </div>
            <div class="card-body">
                <table class="table table-bordered table-sm">
                    <thead>
                        <tr>
                            <th>Author</th>
                            <th>Title</th>
                            <th>Content</th>
                        </tr>
                    </thead>
                    <tbody>                 
                    </tbody>
                </table>
          </div>
      </div>
   </div>
</div>

<script>
    function Get() {

        $.ajax({

            url: "http://newsapi.org/v2/everything?q=tesla&from=2021-01-23&sortBy=publishedAt&apiKey=467f8d2e2df54419a7d03fc35876e296",
            type: "GET",
            success: function (response) {
                calistir(response)
            }

        });

    }

    function calistir(data) {
        for (var i = 0; i < data.articles.length; i++) {
            var author = data.articles[i].author;
            var title = data.articles[i].title;
            var description = data.articles[i].description;

            var html = "";
            html += "<tr>";
            html += "<td>" + author + "</td>";
            html += "<td>" + title + "</td>";
            html += "<td>" + description + "</td>";
            html += "</tr>";
            $("table").append(html);
        }
    }
</script>

Projenin amaci : https://newsapi.org/ adresinden hazirlanmis olan api'lerden birine request atarak datalari "get" etmektir.Bu islemi ajax yöntemiyle gerçeklestiriyoruz.

teslablogger_client's People

Contributors

nihatcanertug avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.