Here is my code snippet :
wp_enqueue_script( 'ajax-script', get_stylesheet_directory_uri().'/js/myajax.js', array('jquery'), 1.0 );
wp_localize_script( 'ajax-script', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
My problem is when ever i use that ajax_object it won't work. Also myajax.js file won't load to the site. But works fine in Admin panel.
Why that enqueue script & localize script not working in front end ?
wp_enqueue_scriptsaction on the front end.wp_headworks as well (wp_enqueue_scriptsis better)'ajax-script'handle wouldn't exist. so have you used thewp_enqueue_scriptsaction or not? update your question to show the full code you've used to enqueue and localize.