Skip to main content
Topic: Fetching data from API and inserting in add form (Read 1001 times) previous topic - next topic

Fetching data from API and inserting in add form

I'm creating a Library Management System, and I want to fill the "Books" datatable by fetching data from Google Books API (https://developers.google.com/books/docs/v1/using).

The Books datatable has the following fields: id, title, author, image, price

Now, when I am on the books/add.php page, I want the user to write the name of the book in a textbox; and based on this query, a dropdown menu should appear, with the results from the Google Books API.

Once a user finds the desired book, he will click on it, and the title, author, image fields will get filled automatically.
The user will manually enter the price, before submitting the add form.




How can I achieve this?

 

Re: Fetching data from API and inserting in add form

Reply #1
@junaid97‍ by using the client event in add page field properties to write a js code that fetches the data and loads it to the input when the user enters the book name. Or you could edit the page as Custom and write your code.