Sample AJAX Call in WordPress
[code]
$jx.ajax({
url: ajaxurl,
dataType: “json”,
type: ‘POST’,
data: ‘action=get-style-css&editor-id=’ + $editor_id + ‘&builder-id=’ + $builder_id + ‘&styles-tab-selector=’ + $styles_tab_selector,
success: function(result) {
//actions here
}
});
[/code]
[code]
add_action(‘wp_ajax_init_ts_data’, array($this, ‘ajaxInitTSData’));
add_action(‘wp_ajax_nopriv_init_ts_data’, array($this, ‘ajaxInitTSData’));
[/code]
[code]
public function ajaxInitTSData() {
$ret[‘success’] = true;
print_r( json_encode($ret));
exit;
}
[/code]
retrieving reviews…