Skip to content

I’m trying to use Javascript Fetch rest API in spring boot project by catogeryId

Hi im trying to get rest api data on html page by javascript fetch but i cant be able to fetch url categoryId can anyone help me out. Ill be so thank full of them.this is my Html page where i fetching my data

This is my rest controller from where i m getting my data

Answer

As im already fetch my data and in that data i have my catogeryId so i just take it out from that in this way onclick=”productBrandDataById(‘+data[i].catogeryId+’)”>’ Then i just fetch my data with this catogeryId like this fetch(‘/api/get_productc/’+catagoryId) then ill use it.