Skip to content

Instantly share code, notes, and snippets.

@everaldomatias
Created September 21, 2017 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everaldomatias/8afc2b2befe2f98c8cbebe959d11d8d5 to your computer and use it in GitHub Desktop.
Save everaldomatias/8afc2b2befe2f98c8cbebe959d11d8d5 to your computer and use it in GitHub Desktop.
// JS
jQuery(function() {
jQuery('.add-request-quote-button').on('click', function() {
jQuery.ajax({
type : 'POST',
url : 'wp-admin/admin-ajax.php',
dataType: 'json',
data : action_agp_qdt_itens,
success: function (response) {
jQuery('#raq_item_number').addClass('teste');
}
});
});
});
// PHP
function agp_qdt_itens_ajax() {
echo YITH_Request_Quote()->get_raq_item_number();
}
add_action( 'wp_ajax_action_agp_qdt_itens', 'agp_qdt_itens_ajax' );
add_action( 'wp_ajax_nopriv_action_agp_qdt_itens', 'agp_qdt_itens_ajax' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment