function preview_admin(field, preview_url) { $.ajax({ type: 'GET', url: preview_url, data: { data: $('#id_' + field).val() }, success: function (data, textStatus, jhr) { $('#preview-' + field).html(data).show('fast'); } }); }