title: ternary calling functions in ajax call
body: <p>//UPDATE: nevermind I'm dumb. It works, but I'll change it to if/else</p>
  
  <p>I have an ajax function and on success it'll update some css styles. If valueExists is true, I'd like to add multiple css styles and I place these css styles in a function</p>
  
  <pre><code>.success(function(data) {
      data.valueExists ? multipleChanges($("#element")) : $("#element").addClass("classStyleTwo");      
  });
  
  //Outside of success function multiple css changes
  function multipleChanges(element){
          $(element).addClass("classStyleTwo");
          $(element).css({color: "#1abc9c"});
  }
  </code></pre>
  
  <p>The problem is that the ternary is in an async request, so the function multipleChanges is called instantly. I'm still a bit rusty on callback functions I tried placing multipleChanges inside another  function like...</p>
  
  <pre><code>function wrapper (cb, element){
     return cb(element);
  }
  
  .success(function(data) {
      data.valueExists ? wrapper(multipleChanges, $("#element")) : $("#element").addClass("classStyleTwo");      
  });
  </code></pre>