89 lines
2.3 KiB
JavaScript
89 lines
2.3 KiB
JavaScript
|
jQuery(document).ready(function($) {
|
||
|
});
|
||
|
|
||
|
/*
|
||
|
* Button: Ajax Data
|
||
|
*
|
||
|
* @Json data Ajax data
|
||
|
* @jQuery $el jQuery field element
|
||
|
*/
|
||
|
|
||
|
// filter('acfe/fields/button/data', data, $el);
|
||
|
// filter('acfe/fields/button/data/name=importer', data, $el);
|
||
|
// filter('acfe/fields/button/data/key=field_6213688a5f49e', data, $el);
|
||
|
acf.addFilter('acfe/fields/button/data/name=importer_les_venues', function(data, $el){
|
||
|
console.log('data');
|
||
|
// add custom key
|
||
|
data.custom_key = 'value';
|
||
|
|
||
|
// return
|
||
|
return data;
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
/*
|
||
|
* Button: Before Ajax Request
|
||
|
*
|
||
|
* @jQuery $el jQuery field element
|
||
|
* @Json data Ajax data
|
||
|
*/
|
||
|
|
||
|
// action('acfe/fields/button/before', $el, data);
|
||
|
// action('acfe/fields/button/before/name=importer', $el, data);
|
||
|
// action('acfe/fields/button/before/key=field_6213688a5f49e', $el, data);
|
||
|
acf.addAction('acfe/fields/button/before/name=importer_les_venues', function($el, data){
|
||
|
// log arguments
|
||
|
console.log($el);
|
||
|
console.log(data);
|
||
|
|
||
|
});
|
||
|
|
||
|
/*
|
||
|
* Button: Ajax Success
|
||
|
*
|
||
|
* @jQuery $el jQuery field element
|
||
|
* @Json data Ajax data
|
||
|
*/
|
||
|
|
||
|
// action('acfe/fields/button/success', response, $el, data);
|
||
|
// action('acfe/fields/button/success/name=importer', response, $el, data);
|
||
|
// action('acfe/fields/button/success/key=field_6213688a5f49e', response, $el, data);
|
||
|
acf.addAction('acfe/fields/button/success/name=importer_les_venues', function(response, $el, data){
|
||
|
console.log('success');
|
||
|
// json success was sent
|
||
|
if(response.success){
|
||
|
|
||
|
// log arguments
|
||
|
console.log(response.data);
|
||
|
console.log($el);
|
||
|
console.log(data);
|
||
|
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
/*
|
||
|
* Button: Ajax Complete
|
||
|
*
|
||
|
* @jQuery $el jQuery field element
|
||
|
* @Json data Ajax data
|
||
|
*/
|
||
|
|
||
|
// action('acfe/fields/button/complete', response, $el, data);
|
||
|
// action('acfe/fields/button/complete/name=importer', response, $el, data);
|
||
|
// action('acfe/fields/button/complete/key=field_6213688a5f49e', response, $el, data);
|
||
|
|
||
|
acf.addAction('acfe/fields/button/complete/name=importer_les_venues', function(response, $el, data){
|
||
|
console.log('complete');
|
||
|
// parse json response
|
||
|
response = JSON.parse(response);
|
||
|
|
||
|
// log arguments
|
||
|
console.log(response);
|
||
|
console.log($el);
|
||
|
console.log(data);
|
||
|
|
||
|
});
|
||
|
|