I would like to put out a form on the front end of wordpress, and be able to post the data into Advanced Custom Fields. However, it seems I only have access to 'title' and 'content'. Am I able to target the custom fields from JS file specifically?
Below code line 5, I tried using "getField('chapter'): $(".chapter").val(),", but it doesn't work.
postNote(e) {
var ournewPost ={
'title': $(".new-note-title").val(),
'content': $(".new-note-body").val(),
getField('chapter'): $(".chapter").val(),
'status': 'publish'
}
$.ajax({
beforeSend: (xhr) => {
xhr.setRequestHeader('X-WP-Nonce', Data.nonce);
},
url: Data.root_url + '/wp-json/wp/v2/note/',
type: 'POST',
data: newNote,
});
}