title: Trigger parent function on ajax success in reactjs
body: <p>I know how to get a parent function to run if you trigger it on a onClick event (or similar), but I want to trigger it on ajax success. So pretty much this constallation:</p>
  
  <pre><code>var parent = React.createClass({
      someFunction: function(){
          console.log("Parent function triggered");
      },
      render: function(){
          return (
              &lt;Child callback={this.someFunction} /&gt;
          );
      }
  });
  
  var child = React.createClass({
      getInitialState: function(){
          return { data: "Wat" };
      },
      componentDidMount: function(){
          $.ajax({
              url: "some_url",
              method: 'POST',
              data: this.state.data,
              success: function(response){
                  this.props.callback; // This is what I would like to do
              },
              error: function(){
                  console.log("Couldn't do it cap'n");
              }
          });
      },
      render: function(){
          return(
              &lt;div&gt;Hello!&lt;/div&gt;
          );  
      }
  });
  </code></pre>
  
  <p>I could do it by triggering an event, but surely it should be possible to do it when I have access to the function. The function is also passed down correctly, and I can see it as a function if I do a <code>console.log(this.props.callback);</code></p>