title: Cannot read property 'bind' of undefined
body: <p>I am trying to create a cart, In this I am trying to call an ajax post function, by putting an add button in cart with item. In my below code in cart function, if I remove this line of <code>onclinck</code> function  </p>
  
  <pre><code>onClick={ this.createNeworder.bind( this, this.orderid, this.item.product_code)}&gt; Add &lt;/a&gt; &lt;/span&gt; , 
  </code></pre>
  
  <p>or add just a simple button, it show the item and button in cart. But if I add this line of code then it gives the error <code>Cannot read property 'bind' of undefined</code> and don't add any item in cart. I have used same <code>onclick</code> function in other page code and It is working but I don't know why it is not working here.</p>
  
  <pre><code>var orderid = document.getElementById('bizorderid').innerHTML;
  console.log(orderid);
  
  function testAjax() {
  return $.ajax({
              type: 'GET',
              url: "/restaurant/menu/list/100/1",
              headers: {
                                      Accept : "application/json",
                                                   "Content-Type":   "application/json"
                      },
              async : false
              }).done( function(json) {
                      //tata = json;
  
  //                      console.log(json);
                      return json;
              }).responseText;
  
              }
  
    var dt = testAjax();
    var productsCollection = JSON.parse(dt);
    //var promise = $.parseJSON(pt);
    console.log(productsCollection)
  
  /** @jsx React.DOM */
  
  var Product = React.createClass({
  getInitialState: function() {
    return {
      added: false
    };
  },
  
  addToCart: function(e) {
    if(!this.state.added) {
      // add
      $.publish('cart.added', this.props.data);
    }
    else {
      // remove
      $.publish('cart.removed', this.props.data.id);
    }
  
    this.setState({
      added: !this.state.added
    });
  },
  
  render: function() {
      // assign to props
      var data = this.props.data;
  
  return (
        &lt;div className="card"&gt;
          &lt;div className="title"&gt;
            &lt;h3&gt;&lt;a&gt;{data.product_name}&lt;/a&gt;&lt;/h3&gt; &lt;/div&gt;
            &lt;div className="content"&gt;Price :{data.price}  &lt;br /&gt;category : {data.groupid} &lt;br /&gt;
                      Units: {data.unit} &lt;br /&gt; Code : {data.product_code} &lt;br /&gt;
              &lt;button className={this.state.added ? 'button  success' : 'button small radius'} onClick={this.addToCart}&gt;
                {this.state.added ? 'Remove' : 'Add to cart'}
              &lt;/button&gt;
          &lt;/div&gt;
              &lt;/div&gt;
            );
        }
    });
  
  
    /** @jsx React.DOM */
  
    var ProductsList = React.createClass({
        render: function() {
  
            var products = this.props.data.map(function(product) {
                return (
                  &lt;li key={product.product_code}&gt;
                    &lt;Product data={product} /&gt;
                  &lt;/li&gt;
                )
            });
  
            return (
              &lt;ul className="clearfix"&gt;
                {products}
              &lt;/ul&gt;
            );
        }
    });
  
    var Cart = React.createClass({
  
    createNeworder: function(orderid, product_code) {
                                        //var tbn = this.iid;
                                       // var tbn = iid;
                                  var o_id = orderid;
                                  console.log(o_id);
                                  var p_code = product_code;
                                  var unit = 1;
                                        $.ajax({
                                                  url: '/restaurant/order/product/'+o_id+'/'+p_code+'/'+unit,
                                                  type: 'POST',
                                                  headers: {
                                                              // Accept : "application/json",
                                                               "Content-Type": "application/json"
                                                            },
  
                                                  success: function(data) {
    //                                              console.log(data.orderid);
                                                    var orderid = data.orderid;
                                                    console.log(orderid);
  
                                                  //  window.location = '/diner/orderdiner/'+orderid;
  
                                                    this.setState({data: data});
                                                          }.bind(this),
                                                  error: function(xhr, status, err) {
                                         //   console.error(this.props.url, status, err.toString());
                                                          }.bind(this)
                                                        });
                                      },
  
  
    getInitialState: function() {
          // also subscribe to product events here
          $.subscribe('cart.added', this.addItem);
          $.subscribe('cart.removed', this.removeItem);
  
          return {
            items: [],
            total: 0,
            currency: 'EUR'
          };
        },
  
        addItem: function(e, item) {
          this.state.items.push(item);
          this.forceUpdate();
  
          this.countTotal();
        },
  
        removeItem: function(e, itemId) {
          var itemIndexInArray;
  
          this.state.items.some(function(item, index) {
            if(item.id === itemId) {
              itemIndexInArray = index;
              return true;
            }
          });
  
          this.state.items.splice(itemIndexInArray, 1);
          this.forceUpdate();
  
          this.countTotal();
        },
  
     countTotal: function() {
          var total = 0;
  
          this.state.items.forEach(function(item, index) {
            total += item.price;
          });
  
          this.setState({
            total: total
          })
        },
  
        render: function() {
  
            var items = this.state.items.map(function(item) {
              //      var pro_code = {item.product_code} ;
      //              console.log(pro_code);
                return (
                  &lt;li key={item.id} className="cart-item"&gt;
                    &lt;span className="cart-item__name"&gt;{item.product_name}&lt;/span&gt;
                    &lt;span className="cart-item__price"&gt;{item.price} {item.currency}&lt;/span&gt;
                    &lt;span hidden className="cart-item__price"&gt;{item.product_code} {item.currency}&lt;/span&gt;
              &lt;span &gt; &lt;a onClick={ this.createNeworder.bind( this, this.orderid, this.item.product_code)} &gt; Add &lt;/a&gt; &lt;/span&gt;
                  &lt;/li&gt;
                )
            });
  
            var body = (
              &lt;ul&gt;
                {items}
              &lt;/ul&gt;
            );
  
            var empty = &lt;div className="alert alert-info"&gt;Cart is empty&lt;/div&gt;;
  
              return (
              &lt;div className="panel panel-default"&gt;
                &lt;div className="panel-body"&gt;
                  {items.length &gt; 0 ? body : empty}
                &lt;/div&gt;
              &lt;/div&gt;
            );
        }
    });
  
  
    React.render(&lt;ProductsList data={productsCollection} /&gt;, document.getElementById('tabmenu'));
          React.render(&lt;Cart /&gt;, document.getElementById('cart'));
  </code></pre>