I have an error in my code with Ajax function on $(".addClick"); When I click on trigger, it's alert me "Error saving click". I tried to find out what the error, but I could not. Poor knowledge of Ajax, but has long been working with PHP, HTML, MySQL and CSS.
Here is my code:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" >
    $(document).ready(function () {
        var user_subid = "b5tl99gvutf4d6m02tnstr7lh3";
        var fileid = "2408";
        function checkSurvey() {
            return $.ajax({
                url: "checkSurvey.php",
                method: 'GET',
                data: "user_subid=" + user_subid + "&" + "fileid=" + fileid,
                statusCode: {404: function () {
                    $('.status').html("<p>File for cheking survey was not found.</p>");
                }},
                async: false,
                success: function (data) {
                    if (data == 0) {
                        setInterval(function () {
                            checkSurvey();
                        }, 5000);
                        $('.status').html("<p><img src='preloader.GIF' /> Please check survey and don't close this Window...</p>");
                    }
                    if (data == 1) {
                        $('.status').html("<p>You can download your file. Please wait or <a href=\"http://www.filecash.net/downloader/survey.php?file=5342fa2b23f4b\">click here</a>.</p>");
                        $('.status').removeClass("alert-info");
                        $('.status').addClass("alert-success");
                        location.reload();
                    }
                    if (data != 1 && data != 0) {
                        $('.status').html("<p>" + data + "</p>");
                    }
                }
            });
        }
        //end function checkSurvey
        var clicked = 0;
        $('.addClick').bind('click', function (e) {
            $.ajax({
                url: "clickSave.php",
                method: 'POST',
                error: alert("Error saving click"),
                data: "user_subid=" + user_subid + "&" + "fileid=" + fileid,
                statusCode: {404: function () {
                    $('.status').html("<p>File not found.</p>");
                }},
                success: function (data) {
                    if (clicked == 0) {
                        clicked = 1;
                        $('.status').addClass("alert alert-info");
                        $('.status').html("<p><img src='preloader.GIF' /> Loading...</p>");
                        checkSurvey();
                    }
                }
            });
        });
    });
</script>
Thanks in advice.
 
     
     
     
    