You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a new tag I send it via ajax and get back an ID. If I then select another tag, it sends the data via ajax again but the value for that new ID is empty. I'm not sure I'm adding the tag right.
The data.id value is printed to the console and is correct so I'm submitting it to addTags() and the form data on the next submit looks like:
ids[]: 245290
ids[]: 245289
ids[]:
ids[]: 245283
function sendAllTagIds(e) {
const tagElements = tagify.getTagElms();
const tagIds = tagElements.map(tag => tag.getAttribute('id'));
const value = e.detail.data.value;
$.post('/action/add-tag.php', { ids: tagIds })
.done(function(response) {
var data = JSON.parse(response);
if(data.success) {
tagify.settings.whitelist.push(data.value);
// Only add the new tag if the new_tag_id exists
var id = data.id;
console.log('New tag ID:', id);
if (id) {
tagify.addTags([{ value: value, id: id }]);
}
} else {
warn(data.message);
}
})
.fail(function(jqXHR, textStatus, errorThrown) {
console.error('Error updating tags:', textStatus, errorThrown);
});
}
Any help appreciated. Thanks.
The text was updated successfully, but these errors were encountered:
When adding a new tag I send it via ajax and get back an ID. If I then select another tag, it sends the data via ajax again but the value for that new ID is empty. I'm not sure I'm adding the tag right.
The data.id value is printed to the console and is correct so I'm submitting it to addTags() and the form data on the next submit looks like:
ids[]: 245290
ids[]: 245289
ids[]:
ids[]: 245283
Any help appreciated. Thanks.
The text was updated successfully, but these errors were encountered: