Home Forums Backend Issues (wp-admin) Backend validation prevents saving options Reply To: Backend validation prevents saving options

  • I don’t know what the fix was, I think I saw a note about it in the changelog. I’m not a dev working on the site, just another user.

    Debugging JS can be difficult and it get’s more complex if AJAX is involved.

    When I’m working on straight JS I usually add a console.log(SOMETHING); to see what values are. Same as using echo or print_r in PHP. Sometimes I throw in alert(SOMETHING); for simple values.

    When dealing with AJAX you have 2 things to contend with, the JS and the server side PHP code. It’s impossible to see what’s happening on the server side in the browser. When I’m dealing with the PHP side I use errro_log() to write stuff to the error log.

    Debugging someone else’s JS/AJAX can be infinitely more complex than debugging your own, especially when AJAX is involved. While I’m doing dev on my own stuff and I’m dealing with AJAX, I am usually returning JSON and I have a console.log(json); so that I can see what’s being returned. Then I can simple do something like echo json_encode($_POST); exit; on the PHP side to see what was submitted, or to see whatever I want to see from the server in the AJAX response. Tracking down where to do these things in someone else’s code can be done but it’s a lot more difficult.