title: Uncaught SyntaxError: Unexpected token < in JSON at position 0 at Function.parse [as parseJSON] (<anonymous>)
body: <p>I have problem with adding data to mysql database here is code below (if needed i can add php code too). it says:</p>
  
  <blockquote>
    <p>at Function.parse [as parseJSON] at Object.success (form.js:16) at u
    (jquery.min.js:2) at Object.fireWith [as resolveWith]
    (jquery.min.js:2) at k (jquery.min.js:2) at
    XMLHttpRequest.(jquery.min.js:2)</p>
  </blockquote>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
      $('form').submit(function(event) {
          var json;
          event.preventDefault();
          $.ajax({
              type: $(this).attr('method'),
              url: $(this).attr('action'),
              data: new FormData(this),
              contentType: false,
              cache: false,
              processData: false,
              error: function (xhr, status, err) {
                  console.error(this.props.url, status, err.toString());
              }.bind(this),
              success: function(result) {
                  json = jQuery.parseJSON(result);
                  if (json.url) {
                      window.location.href = '/' + json.url;
                  } else {
                      alert(json.status + ' - ' + json.message);
                  }
              },
          });
      });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;!-- Content Header (Page header) --&gt;
      &lt;section class="content-header"&gt;
          &lt;h1&gt;
              ახალი აქციის დამატება
          &lt;/h1&gt;
         &lt;!-- &lt;ol class="breadcrumb"&gt;
              &lt;li&gt;&lt;a href="#"&gt;&lt;i class="fa fa-dashboard"&gt;&lt;/i&gt; Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Forms&lt;/a&gt;&lt;/li&gt;
              &lt;li class="active"&gt;General Elements&lt;/li&gt;
          &lt;/ol&gt;--&gt;
      &lt;/section&gt;
  
      &lt;!-- Main content --&gt;
      &lt;section class="content"&gt;
          &lt;div class="row"&gt;
              &lt;!-- left column --&gt;
              &lt;div class="col-md-12"&gt;
                  &lt;!-- general form elements --&gt;
                  &lt;div class="box box-primary"&gt;
  
                      &lt;!-- /.box-header --&gt;
                      &lt;!-- form start --&gt;
                      &lt;form action="/admin/addslider" method="post"&gt;
                          &lt;div class="box-body"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;label for="title"&gt;აქციის სათაური&lt;/label&gt;
                                  &lt;input type="text" class="form-control" name="title" placeholder="აქციის სათაური"&gt;
                              &lt;/div&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;label for="image"&gt;სურათის მიმაგრება&lt;/label&gt;
                                  &lt;input type="file" name="img"&gt;
  
                                  &lt;!--&lt;p class="help-block"&gt;Example block-level help text here.&lt;/p&gt;--&gt;
                              &lt;/div&gt;
  
                              &lt;div class="form-group"&gt;
                                  &lt;label&gt;აქციის აღწერა&lt;/label&gt;
                                  &lt;textarea class="form-control" name="description" rows="3" placeholder="Enter ..."&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
  
                              &lt;div class="form-group"&gt;
                                  &lt;label for="position"&gt;აქციის პოზიცია&lt;/label&gt;
                                  &lt;input type="number" class="form-control" name="pos" min="1" max="20" &gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;!-- /.box-body --&gt;
  
                          &lt;div class="box-footer"&gt;
                              &lt;button type="submit" class="btn btn-primary"&gt;ატვირთვა&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
                  &lt;!-- /.box --&gt;
          &lt;/div&gt;
          &lt;!-- /.row --&gt;
      &lt;/section&gt;
      &lt;!-- /.content --&gt;</code></pre>
  </div>
  </div>
  </p>