Jump to content

Javascript Help

Go to solution Solved by SSL,
Okey so here is the code, its almost exactly the same as yours exept i cant get mine to work.

 

Your access to the elements of the data objects is wrong. Should be something like so:

data.with[0].createddata.with[0].content.temperature
<!DOCTYPE html><html><head><title>Hello World</title><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script><script type="text/javascript">/*  * Wrap javascript in an anonymous closure. This will limit the scope of any * functions or variables and ensure that the '$' shorthand does not collide * with any other libraries that we might be using. */(function ($, document, undefined) {/*  * Execute javascript using the jQuery shorthand for jQuery(document).ready(). * This will run the javascript when the DOM is ready. */$(function () {  /*   * Use jQuery.getJSON() to retrieve the data. Update the page HTML with   * values from the data.   */  $.getJSON("https://dweet.io/get/latest/dweet/for/xQubeZ_temperature", function (data) {    var $thing,        $created,		$temperature,		    $thing = $('#thing');    $created = $('#created');    $temperature = $('#temperature');	    $thing.text(data.with.thing);    $created.text(data.with.created);	$temperature.text(data.with.temperature);  });});})(jQuery, this);</script></head><body><h1>Hello World</h1><p><strong>created:</strong> <span id="created"></span></p><p id="thing"></p><p id="temperature"></p></body></html>

If I can't see your code I can't help.

Okey so here is the code, its almost exactly the same as yours exept i cant get mine to work.

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
Share on other sites

Link to post
Share on other sites

Okey so here is the code, its almost exactly the same as yours exept i cant get mine to work.

 

Your access to the elements of the data objects is wrong. Should be something like so:

data.with[0].createddata.with[0].content.temperature
Link to comment
Share on other sites

Link to post
Share on other sites

 

Your access to the elements of the data objects is wrong. Should be something like so:

data.with[0].createddata.with[0].content.temperature

It worked great! Thanks alot :D

FX-8350 GTX760 16GB RAM 250GB SSD + 1TB HDD

 

"How many roads must a man walk down?" "42"

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×