0

I'm trying to get the value of the first 'price' field at the url:

http://pubapi.cryptsy.com/api.php?method=singleorderdata&marketid=132

I am currently using the following code to do so:

getJSON('http://pubapi.cryptsy.com/api.php? 
method=singleorderdata&marketid=132').then(function(data) {
var final = (data.return.DOGE.sellorders.price * totalcost) * 0.985
var finished = final.toFixed(8)

I have a strong feeling that I have done this bit wrong:

data.return.DOGE.sellorders.price

Any ideas?

Thanks!

1 Answer 1

1

data.return.DOGE.sellorders[0].price because sellorders is an array

$.getJSON('http://jsbin.com/pudoki/1.json', function(data){
  alert(data.return.DOGE.sellorders[0].price);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.