Skip to content

Instantly share code, notes, and snippets.

@BobbyRuby
Last active April 28, 2020 02:12
Show Gist options
  • Save BobbyRuby/44fe6479939dfb5e7925f82939dddb03 to your computer and use it in GitHub Desktop.
Save BobbyRuby/44fe6479939dfb5e7925f82939dddb03 to your computer and use it in GitHub Desktop.
Usage Example
var get_client_projects = jQuery.post(dir + "/wp-content/plugins/rvms/class_RvmsHandleJSPostRequests.php",
{
requested: 'get_client_projects', client_id: selected_client_id
},
function (data) {
}, 'json');
get_client_projects.done(function (data) { // success
var select_option_arrays = processData(data, selected_client_id);
projects_managed.html(select_option_arrays[0]); // add options
projects_associated.html(select_option_arrays[0]); // add options
cgpm_clients.html(select_option_arrays[1]); // add options
projects_managed.trigger('change.select2');
projects_associated.trigger('change.select2');
cgpm_clients.trigger('change.select2');
});
get_client_projects.fail(function () {
alert('Error! Something went wrong, please try again.');
});
get_client_projects.always(function () {
rvms_client.parent().find('#loading-img').remove(); // remove image
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment