function append_id(){ if ($("#object_id").length == 1) { return "&id="+$("#object_id").val(); } else{ return ''; }; } $(document).on('change', 'select', function(e) { if(!e.target.className == 'widget_field_select') { switch(e.target.id) { case 'page_module_app_id': $.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id()); break; case 'page_app_frontend_url': case 'page_part_widget_path': $.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() ); break; case 'page_design': $.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id()); break; case 'page_part_public_r_tag': $.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id()); break; }; } else { $.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() ); } }); $(document).on('click', '.part_kind', function(event) { $('.part_kind_partial').hide(); $('#part_' + $(this).attr('value')).show(); });