question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

json mapquest traffic incidents

See original GitHub issue

Anything I’m doing wrong?

Here’s the error and code uncaught

Ultimately, I want to display the following results set dynamically from JSON using tabulator.

capture

<html>
  <head>
    <script   src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
    <script   src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js" integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E=" crossorigin="anonymous"></script>
	
	<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/3.3.1/css/tabulator.min.css" rel="stylesheet">
	<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/3.3.1/js/tabulator.min.js"></script>
	
  </head>
  <body>
  
    <div id="example-table"></div>
  
  <script> 
  
  $("#example-table").tabulator("setData", "https://www.mapquestapi.com/traffic/v2/incidents?&outFormat=json&boundingBox=49.333400639691035%2C-122.77496337890625%2C49.15162235335807%2C-123.23638916015624&filters=construction%2Cincidents%2Cevent%2Ccongestion&key=PdA752LzJf3TG9HStfoASvzllR1Lb6FV"); 
  
  

  
  //Build Tabulator 
  $("#example-table").tabulator({ 
	height: "311px", 
	layout: "fitColumns", 
	placeholder: "No Data Set", 
	columns: [ 
		{title: "Id", field: "incidents.Id", width: 200 }, 
		
	], 
	
			rowClick: function (e, row) { //trigger an alert message when the row is clicked 
			alert("Row " + row.getData().id + " Clicked!!!!"); 
			
		}, 
			
});
			
			ajaxResponse: function ("url, params, response") { 
			//url - the URL of the request 
			//params - the parameters passed with the request 
			//response - the JSON object returned in the body of the response. 
			
			return response.incidents; 
			//return the data property of a response json object 
			
			}, 
			
			}); </script>
  
 
  
  </body>
</html>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Diskoveredcommented, Nov 21, 2017

Ok got it, tnx again.

0reactions
olifolkerdcommented, Nov 21, 2017

if you wanted to show just one of the properties of that object you can use dot notation to set it in the field property of the column definition “parameterizedDescription.crossRoad2”

if you wanted to view a JSON encoded view of the object you would need to use a custom formatter.

Cheers

Oli

Read more comments on GitHub >

github_iconTop Results From Across the Web

Traffic API - Incidents - GET - MapQuest Developer
The Traffic Incidents request returns a structured list of traffic incidents for a specified bounding box in JSON or XML formats, e.g., road...
Read more >
Traffic API - Incidents - POST - MapQuest Developer
The Traffic Incidents request returns a structured list of traffic incidents for a specified bounding box in JSON or XML formats, e.g., road...
Read more >
Traffic API - Overview | MapQuest API Documentation
The Traffic Incidents request returns a structured list of traffic incidents for a specified bounding box in JSON or XML formats, e.g., road...
Read more >
Traffic Service - MapQuest API Documentation
Traffic incidents sample using the MapQuest Traffic API. ... MapQuest Traffic. /traffic/v2/incidents. Location. Output Format. JSON, XML. Advanced Options.
Read more >
MapQuest JavaScript Library — v1.0 - L.mapquest.traffic
Documentation for the MapQuest.js traffic API interface. ... Queries the MapQuest Incidents API, and returns a JSON object with the list of incidents...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found