How to get JSON result in grid/tabular format while calling an API?

Shruti Vaishya

I'm using railway API in my website and want the Train data in grid format. Please help me with the same.

I want all the variables (Train name, Train number, Departure Time, Arrival Time, Travel Time, Availability Status) in a table format. I'm calling two APIs to get the final result. How can I achieve this using AngularJs?

  function between(trainData) {
    var total = trainData.TotalTrains;

    for (i = 0; i < total; i++) {
      var source = trainData.Trains[i].Source;
      var destination = trainData.Trains[i].Destination;
      var name = trainData.Trains[i].TrainName;
      var number = trainData.Trains[i].TrainNo;
      var ttime = trainData.Trains[i].TravelTime;
      var deptime = trainData.Trains[i].DepartureTime;
      var arrtime = trainData.Trains[i].ArrivalTime;


          $('.' + className + '').append("<br/>" + name + "(" + number + ")" + "  " + ttime + " " + deptime + " " + arrtime  + "<br/>");
        }
      }
    }
sheikh hamza

you can append with the in the end like

$('.' + className + '').append("<table><tr><th>name</th><th>number </th><th>ttime </th><th>deptime </th><th>arrtime </th><th>classcode </th><th>status </th><th>jdate </th></tr><tr><td>" + name + "</td><td>" + number + "</td><td>" + ttime + "</td><td>" + deptime + " </td><td>" + arrtime + " </td><td>" + classcode + "</td><td>" + status + "</td><td>" + jdate +  "</td></tr></table>");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Get all Cassandra query result in JSON format Using Java API

How to get values from a list while calling API

unable to get desired json format while creating laravel 5 api

Get desired result while calling API using Postman but don't when using RestShart in console program

JAVA/API how to get the correct JSON format

How can I get result format JSON from Athena in AWS?

Error: While calling Flask API (Json Decodeerror)

How to get the Json data from eBay api to save in CSV format?

How to get data from API in JSON format on ReactJS and Fill dropdown

How to use DOMSANITIZER(bypassSecurityTrustUrl) while calling the API

Can anyone suggest how to generate Rest body dynamically while calling Get API with Query match

How Deserialize JSON Api result

How to format a custom type in the json result?

How to get the result of json into the header

How to get the result in below format in SQL Server?

how to get the sql result in below format

Handle multiple JSON repsponse while calling foreign api using RestTemplate

How to see request body in JSON format if Retrofit2 is used while sending POST call to API?

How to pass an array of object into a payload in a JSON format while making a api request

Cannot get video duration while calling YT video API

How to get the output into a json format?

How to get the value for the given json and get result

Get query result in Thoth.Json encodable format

Returning json result while consuming web api from mvc controller

JSON result format with JS

Format JSON Result

How to view result from JSON API in browser

How to return files in API JSON result?

How to take the JSON result of API and plot on a map