$(document).ready(function() { $('#adminLeftFloater').rsTabs(); $('#button_analytics').click(function() { var jqxhr = $.ajax({ type: 'POST', url: './index.php?admin_modul=admin_seo&mod=ajax', data: { 'action': 'save_analytics_code', 'google_analytics_code': $('#google_analytics_code').val() } }); jqxhr.success(function(data) { try { var mydata = $.parseJSON(data); if (mydata.status == 'success') { alert('erfolgreich gespeichert'); } else { alert("ERROR: PHP"); } } catch(e) { alert("ERROR: JSON"); } }); jqxhr.error(function() { alert("ERROR: URL"); }); }); $('.button_metatags').click(function() { var metatags = []; $('.metatag_field').each(function(){ metatags.push($(this).val()); }); var jqxhr = $.ajax({ type: 'POST', url: './index.php?admin_modul=admin_seo&mod=ajax&action=save_metatags', data: $('#admin_seo_edit').serialize() }); jqxhr.success(function(data) { try { var mydata = $.parseJSON(data); if (mydata.status == 'success') { alert('erfolgreich gespeichert'); } else { alert("ERROR: PHP"); } } catch(e) { alert("ERROR: JSON"); } }); jqxhr.error(function() { alert("ERROR: URL"); }); }); });