ajaxurl is set only in admin. If this is a frontend ajax (looks like it due to nopriv), you have to localize the script on enqueueing: add_action( 'admin_enqueue_scripts', 'my_enqueue' ); function my_enqueue($hook) { if( 'index.php' != $hook ) return; // Only applies to dashboard panel wp_enqueue_script( 'ajax-script', plugins_url( '/js/my_query.js', __FILE__ ), array('jquery')); // in javascript, object properties are accessed as ajax_object.ajax_url, ajax_object.we_value wp_localize_script( 'ajax-script', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'we_value' => 1234 ) ); } In the JS file, you can reach the ajax_url as a variable of ajax_object: jQuery.ajax( ajax_object.ajax_url, { action: 'lu_ajax', status: 'enabled' }, success: function (a) { alert(a) } See http://codex.wordpress.org/AJAX_in_Plugins