Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
jstree confirmar antes de eliminar

Me gustaría preguntarle al usuario, eliminar o no eliminar y luego llamar a ajax.

Pero, ¿dónde debería estar el método $.confirm ?

El código anterior se elimina primero para la pantalla del usuario y luego se elimina en el backend.

¿Cómo llamar antes de eliminar el método $.confirm ?

 $("#kt_tree_type-make-model").jstree({ "core": { "check_callback": true, "data": data }, "types": { "default": { "icon": "fa fa-folder text-primary" }, "file": { "icon": "fa fa-file text-primary" } }, "contextmenu":{ 'items' : function(node) { var items = $.jstree.defaults.contextmenu.items(); items.create.label = 'ADD'; items.rename.label = 'RENAME'; items.remove.label = 'DELETE'; items.ccp = false; return items; } }, "plugins": ["contextmenu", "state", "types"] }).on('create_node.jstree', function (e, data) { }).on('rename_node.jstree', function (e, data) { }).on('delete_node.jstree', function (e, data) { $.confirm({ type: 'orange', title: 'ARE YOU SURE?', content: 'DELETING.', buttons: { confirm: { text: 'YES, DELETE', action: function () { let node = data.node.id.split('_'); let kind = node[0]; let id = node[1]; $.ajax({ url: `/vehicles/type-make-model/${kind}/delete/${id}`, type: 'get', headers: {'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')}, dataType: 'json', success: function (response) { $.alert({title: false, type: 'green', content: 'Deleted successfully.'}); data.instance.refresh(); }, error: function (xhr, ajaxOptions, thrownError) { $.alert({title: false, type: 'red', content: xhr.responseJSON.message}); data.instance.refresh(); } }); } }, cancel: { text: 'CANCEL' } } }); });
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda