The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

reload window after 'frm-entry-update-field'

Labels

This Discussion is public

Notifications

I had an issue where a modal window had a 'frm-entry-update-field' that changed a value on the parent form. Once the modal closed I wanted the parent to reload to see the value. I tried the <button onCLick="reload"> however every now and then the button would fire before the ajax, so after digging heres some code to check which ajax function completes the 'value' in the settings.data is the url for the ajax function you can check for other values such as the label or message etc... some Ajax functions fire that are not passing values hence the check for 'undefined'. You can also check for a value that is from a modal and then add a parent.location.reload().Hope this is of use, I am an amateur javascript/ajax coder so any glaring errors please adjust my code or let me know. Thx.function getAjaxVariable(variable){var query = variable;var vars = query.split("&");for (var i=0;i<vars.length;i++) {var pair = vars[i].split("=");if(pair[0] == "value"){return pair[1];}}return(false);}jQuery(document).ready(function($){$( document ).ajaxComplete(function( event,request, settings ) {var query = settings.data;if(query != undefined) {var res=getAjaxVariable(query);if(res=="Deposit+Paid" || res=="Enquiry" || res=="Booked" || res=="Balance+Paid" || res=="Pending" || res=="Cancelled"){location.reload();}}});});</script>

Discussion closed.