AJAX Endpoints
AJAX Endpoints
Section titled “AJAX Endpoints”WordPress admin-ajax.php endpoints for dynamic interactions.
Endpoint Registration
Section titled “Endpoint Registration”File: functions.php
add_action('wp_ajax_get_scrapyd_stats', 'ajax_get_scrapyd_stats');add_action('wp_ajax_search_products', 'ajax_search_products');Available Endpoints
Section titled “Available Endpoints”get_scrapyd_stats
Section titled “get_scrapyd_stats”Retrieve Scrapyd job statistics.
Request:
jQuery.post(ajaxurl, { action: 'get_scrapyd_stats', nonce: ajax_nonce}, function(response) { console.log(response);});search_products
Section titled “search_products”Perform product search.
get_price_history
Section titled “get_price_history”Retrieve product price history.
update_product
Section titled “update_product”Update product information (admin only).
Security
Section titled “Security”All endpoints require nonce verification:
check_ajax_referer('dealai_nonce', 'nonce');Next Steps
Section titled “Next Steps”- API Overview - Complete API architecture