I have a code by which I add information to a database and display it on the same page where the form is (using AJAX), but after refreshing the page, the data disappears (in the database they are) How to keep this information on one page. All this should be implemented with the AJAX.   P.S It is possible with the help of Fetch but I cannot implement this method.


<script type="text/javascript">
],function($) {
    $(document).ready(function() {
                submitHandler: function(form) {
                    var customurl = "<?php echo $this->getUrl().'reviews/index/save'?>";
                        url: customurl,
                        data: $('#review_form').serialize(),
                        type: 'POST',
                        dataType: 'json',
                        showLoader: true,
                        cache: false,
                        success: function(data, status, xhr) {
                            return fetch(customurl)
                            .then( response => {})
                        error: function (xhr, status, errorThrown) {
                            console.log('Error happens. Try again.');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.