Why is ajax working on one server and not the next?
The person who setup the staging server placed and .htaccess in the admin side that prevented the site from accessing files in the wp-admin area.
The person who setup the staging server placed and .htaccess in the admin side that prevented the site from accessing files in the wp-admin area.
This is in wp-admin/js/common.js or wp-admin/js/common.min.js: // Scroll into view when focused $(‘#contextual-help-link, #show-settings-link’).on( ‘focus.scroll-into-view’, function(e){ if ( e.target.scrollIntoView ) e.target.scrollIntoView(false); }); Found with a search for show-settings-link in the complete source. 🙂
Use wp_localize_script function set_js_var() { $translation_array = array( ‘blog_name’ => get_bloginfo(‘name’) ); wp_localize_script( ‘jquery’, ‘my_data’, $translation_array ); } add_action(‘wp_enqueue_scripts’,’set_js_var’); If you look at the source of the page you will see something like: <script type=”text/javascript”> /* <![CDATA[ */ var my_data = {“blog_name”:”WordPress 3.5.1 Release”}; /* ]]> */ </script> That is your Javascript variable. You have … Read more
The CSS is in wp-admin/css/colors-classic.css and wp-admin/css/colors-fresh.css and the min versions of those, including the icons32-2x.png ones. I can see them when I grep the directory. For example, wp-admin/css/colors-classic.css:2162. The images themselves are in wp-admin/images, as you can see from the style rules, but you should not be hacking/replacing those. They will be overwritten when … Read more
I added the fieldName parameter to tagit function like this: <script type=”text/javascript”> $(document).ready(function() { $(“#myTags”).tagit( { fieldName: “tages[]” } ); }); </script> Now I can echo $_POST[‘tages’]; since the HTML after execution became: <input type=”hidden” style=”display:none;” value=”d” name=”tages”> In addition, $_POST[‘tages’]; is a PHP array which I can directly put in second parameter of wp_set_object_terms. … Read more
Replace your jquery with this <script type=”text/javascript”> (function($){ $(document).ready(function() { var $option = $(‘.option’); var $fruit = $(‘.fruit-name’); var $last; var parent $option.click(function() { parent=$(this).parents(‘.comment-form-rating’); $(‘.fruit-name’,parent).val(this.innerHTML) }) }); })(jQuery); </script> your script not working because .fruit-name not contain correct reference variable. Updated for debugging put code and check. <script type=”text/javascript”> (function($){ $(document).ready(function() { var $option … Read more
WordPress loads jQuery in “No Conflict” mode. The $ alias does not work. This is the cause of most of the “jQuery doesn’t work” questions on this site. Your code is using that $ alias, despite the Codex warnings against doing so. Use jQuery.(document) or wrap your code like… (function($) { $(function() { // more … Read more
sanitize_text_field( $str ) Sanitize a string from user input or from the db. Checks for invalid UTF-8, Convert single < characters to entity, strip all tags, remove line breaks, tabs and extra white space, strip octets http://codex.wordpress.org/Function_Reference/sanitize_text_field
I have tackled this by putting TinyMCE on the first tab, and making it a static tab, all others are still ajax, would still like it to be ajax, if anyone has any solutions. <div id=”tabs”> <ul id=”wpsca_ul”> <li><a href=”#wpsca_addedit” title=”add page”><?php echo __(‘Add Page’,’wpsca_lang’);?></a></li> <li><a href=”https://wordpress.stackexchange.com/questions/106799/<?php echo get_option(“siteurl’ ).’/?wpsca=wpscalist’;?>” title=”manage addedit”><?php echo __(‘Manage Pages’,’wpsca_lang’);?></a></li> … Read more
Found a solution to it though, pretty simple <script type=”text/javascript”> jQuery(document).ready(function($) { var dw_match_display = $(‘#dw_match_display’); dw_match_display.hide(); if ($(‘#dw_complete’).prop(‘checked’) ) { dw_match_display.show(); } $( ‘#dw_match_details’ ).on( ‘change’, ‘#dw_complete’, function() { dw_match_display.hide(); if ( $(this).prop(‘checked’) ) { dw_match_display.show(); } }); }); jQuery(document).ready(function($) { $( ‘#dw_match_display’ ).change(); }); </script>