Insert data from database if (something)

49 Views Asked by At

I'm working on a site where I'm using an API to connect to a database. I want to get the data from the database IF the elements includes a specific "i:field". If they don't include that specific "i:field" I have no use for them in my project.

Right now my code looks like this

var doomed = TAFFY();
$.getJSON("link_to_API", function( data ) {
     doomed.insert(data);  
 });

I would like to do something like "if the data includes doomed.number == "5", insert it"

var doomed = TAFFY();
$.getJSON("link_to_API", function( data ) {
    if (doomed.number == "5") {
        doomed.insert(data); 
    } 
 });

Do you know if it's possible?

0

There are 0 best solutions below