jQuery(document).ready(function($) { load_address_preview(); }); jQuery('.address_input').change(function () { load_address_preview(); }); function load_address_preview() { var address_id = jQuery("#address_id").val(); var address_before = jQuery("#address_before").val(); var address_after = jQuery("#address_after").val(); jQuery.ajax({ url: office_staff_api.ajaxurl, type: 'post', data: { 'action': 'address_preview', "get_address_preview": "1", "address_id" : address_id, "address_before" : address_before, "address_after" : address_after }, success: function(response) { jQuery('#people-address-preview').html(response); } }); }