Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#idcaso').on('change', function (e) {
- e.preventDefault()
- var valor= $('#idcaso option:selected').val()
- var url=`/actdiarias/json/${valor}`;
- console.log(url)
- fetch(url)
- .then(res => res.json())
- .then(datos =>{
- $('#genid').val(datos._id);
- $('#tienda').val(datos.tienda.nombre);
- $('#statustitulo').val(datos.status.titulo)
- $('#statusdescripcion').val(datos.status.descripcion)
- var creatabla1 = `<table id= "tb" class="table table-striped table-sm">
- <thead>
- <tr>
- <th scope="col">#</th>
- <th scope="col">Articulo <strong class="text-black bg-warning"> selecciona un articulo! </strong></th>
- <th scope="col">Codigo</th>
- <th scope="col">Reporte</th>
- <th scope="col">id</th>
- <th scope="col">operacion</th>
- </tr>
- </thead>
- <tbody> </tbody>
- </table>`
- $('#muestradetalle').append(creatabla1)
- if (datos===null) {
- $('#muestradetalle').html('no se encontraron resultados...')
- console.log('no hayaste nada')
- return false;
- }
- var indice=0
- for (item in datos.articulos) {
- indice++
- var creatabla = `
- <tr>
- <th scope="row">${[indice]}</th>
- <td>${datos.articulos[item].descripcion}</td>
- <td>${datos.articulos[item].codigo}</td>
- <td>${datos.articulos[item].reporte}</td>
- <td>${datos.articulos[item]._id}</td>
- <td><button id="uhm"> explorar</button></td>
- </tr>
- `
- $('#tb tbody').append(creatabla)
- }
- })
- .catch(err => console.log(err))
- $('#muestradetalle').empty().append('')
- });
- $('#uhm').on('click', function (e) {
- alert('hola')
- var seleccionado = datos.articulos.filter((articulo) => {
- if(articulo._id ===datos.articulos[item]._id){
- return true
- }
- else{
- return 'no encontrado'
- }
- console.log(seleccionado)
- })
Add Comment
Please, Sign In to add comment