วันจันทร์ที่ 10 กรกฎาคม พ.ศ. 2566

Javascript fetch api Alpine js

 

 
 async function fetchInsert(url,rowitem) {

       const Responses = await fetch(url, {
            method: 'POST',
            headers: {
               'Content-Type': 'application/json',
               'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                   },
            body: JSON.stringify(rowitem)
            })
        const Res =  await  Responses.json();
        return  Res;
        }

ไม่มีความคิดเห็น: