title: Post request ajax with react using laravel in backend
body: <p>i want to submit very simple form using react in front end and laravel backend i use tutorial facebook react but using ES6 console log display to me  "parsererror" "SyntaxError: Unexpected end of input"</p>
  
  <p>so In React </p>
  
  <pre><code>handleSubmit(e) {
  
      e.preventDefault();
      var name = this.refs.name.value.trim();
      var description = this.refs.description.value.trim();
  
      console.log(`Name : ${name} , and  Description ${description}`);
  
      if (!name || !description) {
          return;
      }
  
      this.props.onCommentSubmit({name: name, description: description});
  
      this.refs.name.value = '';
      this.refs.description.value = '';
      return;
  }
  
  render(){
      return(
          &lt;form  onSubmit={this.handleSubmit.bind(this)}&gt;
              &lt;input type="text" placeholder="Your name" ref="name" /&gt;
              &lt;input type="text" placeholder="Say something..." ref="description" /&gt;
              &lt;input type="submit" value="Post" /&gt;
          &lt;/form&gt;
      );
  
  }
  </code></pre>
  
  <p>and i import this class to global class</p>
  
  <pre><code>constructor() {
      super();
      this.state = { data: [] };
   }
  handleCommentSubmit(d) {
  
      var comments = this.state.data;
      var newComments = comments.concat([d]);
      this.setState({data: newComments});
  
  
      $.ajax({
          type: 'POST',
          url: 'http://localhost:8000/photo',
          dataType: 'json',
          data: d,
          context: this,
          success: (data) =&gt; {
              this.setState({data: data});
          },
          error: (xhr, status, error) =&gt; {
              console.error(this.props.url, status, error.toString());
          }
      });
  
  
  }
  
  
  render(){
  
      return(
          &lt;FormCtl  onCommentSubmit={this.handleCommentSubmit.bind(this)}/&gt;
      );
  }
  </code></pre>
  
  <p>in Backend using Laravel 5.1</p>
  
  <pre><code>public function store(Request $request)
   {
      $photo = new Photo();
  
      if($request-&gt;ajax())
      {
          $data = Input::all();
          print_r($data);die;
  
      }
  
  }
  </code></pre>
  
  <p>in console log i look this "parsererror" "SyntaxError: Unexpected token A"<br />
  i can't recovered data or save it in database</p>