Error message when adding data in the form generated in the Phreeze framework

Asked

Viewed 184 times

1

In all applications generated using the PHP Phreeze framework in local environment (Xampp), when adding a record through the form, which was also generated, the following error message is obtained for the user:

An Unknown error occured

Below the file 'app.js' located in the folder 'scripts', also generated by Phreeze:

getErrorMessage: function(resp) {
var msg = 'An unknown error occured';
    try
    {
        var json = $.parseJSON(resp.responseText);
        msg = json.message;
    }
    catch (error)
    {
        // TODO: possibly use regex or some other more robust way to get details...?
        var parts = resp.responseText.split(app.errorLandmarkStart);

        if (parts.length > 1)
        {
            var parts2 = parts[1].split(app.errorLandmarkEnd);
            msg = parts2[0]
        }
    }

    return msg ? msg : 'Unknown server error';
},

After refreshing the page, it turns out that the Insert in the database was successfully executed, but is not visible on the client side of the application, there seems to be some problem on the part of JSON, or in some part of the layer view.

Has anyone been through this same problem? Just ratifying the problem is only on the client side of the application, since the data is normally entered in the database.

  • Maybe it’s "only on the client side". You need to see how the PHP is responding. Where is this error message coming from? From the browser console?

  • getErrorMessage: Function(Resp) { var msg = 'An Unknown error occured'; Try { var json = $.parseJSON(Resp.responseText); msg = json.message; } catch (error) { // TODO: possibly use regex or some other more robust way to get Details...? var Parts = Resp.responseText.split(app.errorLandmarkStart); if (Parts.length > 1) { var parts2 = Parts[1]. split(app.errorLandmarkEnd); msg = parts2[0] } } Return msg ? msg : 'Unknown server error'; },

  • Put the code in the question, it is more readable. But I think my guess is right: it is something with the answer of PHP. Either it’s coming wrong or the JavaScript is not reading it right.

  • Solved your doubt?

  • Updates the backbone-min.js and underscore-min.js scripts in your script folder that will work!

  • Thanks for the help! Solved.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.