if ('all_products' == select_mode) {
var url = '/wp-content/plugins/wplab-custom-code-master/wplab-custom-code.php';
var request = jQuery.get(url);
request.done( function( response ) {
console.log(response);
checked_items = response;
});
request.fail( function ( xhr, ajaxOptions, thrownError ) {
console.log(xhr.status);
console.log(thrownError);
});
}
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
$args = array(
'numberposts' => -1,
'fields' => 'ids',
'post_type' => 'product',
'post_status' => 'publish'
);
$product_ids = get_posts( $args );
return $product_ids;
Когда я запускаю код, переменная url в js-коде получается неопределенной, но как вы видите, как объявлена переменная.Почему?
Во-вторых, один раз, когда код js работает, вызов ajax возвращает внутреннюю ошибку сервера.Почему?
Спасибо.