How to call POST request using service url – eg

var service_url = Utils.getAbsoluteUrl(getExtensionAssetsPath(‘services/TaxFreeInvoice.Service.ss’));

fetch(service_url, {   

               method: ‘post’,   

               body: ‘{“fileName”:”‘ + fileName + ‘”,”file”:”‘ + file + ‘”,”invInternalid”:”‘ + invInternalid + ‘”,”fileExtension”:”‘ + fileExtension + ‘”}’,    

               headers: {“Content-Type”: “application/json”,”Accept”: “application/json”}                       

               }).then(function(response) {                           

               return response.json()

               }).then(function(res)

               {

                              var data = res;                           

                              if (data.success) {

                                             swal(“Success”, “Your file has been uploaded”, “success”);

                              }

                              else {                               

                              swal(“Oops!”, data.message, “error”); 

                              }

}

Leave a comment

Your email address will not be published. Required fields are marked *