when i using wordpress ajax
in function.php
add_action( 'wp_enqueue_scripts', 'indexnews_scripts' );
function indexnews_scripts() {
if(is_home()){
wp_enqueue_script( 'script-name', get_template_directory_uri() .'abc.js', array('jquery'), '1.0.0', true );
wp_localize_script( 'script-name', 'MyAjax',array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
}}
in the front end it always shows
<script type='text/javascript'>
/* <![CDATA[ */
var MyAjax = {"ajaxurl":"http:\/\/127......\/wp-admin\/admin-ajax.php"};
/* ]]> */
</script>
is there any way keep this code hide in the front end?