Javascript – Uncaught SyntaxError: Unexpected token < in JSON at position 0 at Function.parse [as parseJSON] ()


I have problem with adding data to mysql database here is code below (if needed i can add php code too). it says:

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

$(document).ready(function() {
    $('form').submit(function(event) {
        var json;
            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());
            success: function(result) {
                json = jQuery.parseJSON(result);
                if (json.url) {
                    window.location.href = '/' + json.url;
                } else {
                    alert(json.status + ' - ' + json.message);
<script src=""></script>
<!-- Content Header (Page header) -->
    <section class="content-header">
            ახალი აქციის დამატება
       <!-- <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Forms</a></li>
            <li class="active">General Elements</li>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- left column -->
            <div class="col-md-12">
                <!-- general form elements -->
                <div class="box box-primary">

                    <!-- /.box-header -->
                    <!-- form start -->
                    <form action="/admin/addslider" method="post">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="title">აქციის სათაური</label>
                                <input type="text" class="form-control" name="title" placeholder="აქციის სათაური">
                            <div class="form-group">
                                <label for="image">სურათის მიმაგრება</label>
                                <input type="file" name="img">

                                <!--<p class="help-block">Example block-level help text here.</p>-->

                            <div class="form-group">
                                <label>აქციის აღწერა</label>
                                <textarea class="form-control" name="description" rows="3" placeholder="Enter ..."></textarea>

                            <div class="form-group">
                                <label for="position">აქციის პოზიცია</label>
                                <input type="number" class="form-control" name="pos" min="1" max="20" >
                        <!-- /.box-body -->

                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary">ატვირთვა</button>
                <!-- /.box -->
        <!-- /.row -->
    <!-- /.content -->

Best Solution

Remove this line

json = jQuery.parseJSON(result);

It seems that response your are getting is already a JSON object.