problem with ajax and the path to the php page
To use the WordPress ajax url you can pass the var using wp_localize_script: wp_enqueue_script( ‘functions’, get_bloginfo( ‘stylesheet_directory’ ) . ‘/js/functions.js’, array( ‘jquery’ ), false); wp_localize_script( ‘functions’, ‘MyAjax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) ) ); In your functions.js $.ajax({ type: “POST”, url: MyAjax.ajaxurl, data: {p:alt_p}, success: function(data) { alert(data); } });