The number of requests made are displayed in a small badge as seen. The screenshot below shows the list of requests made when IN is typed in. Since we are making a request on 'onkeyup' event, the number of requests fired would be equal to the number of characters typed. ![]() If you go to the full-screen mode for the above jsbin, open up Interceptor, start listening to requests by clicking the START LISTENING button, and type any letter, then Interceptor would list all the requests that we sent to API. ![]() We further loop through this array and create an HTML string that is appended to the parent ul. The server returns an array of objects that contain the names of the countries. An 'onkeyup' eventListener is added to the input element and everytime we type a character, an XHR is fired to to query for all the country names that contain the typed characters. Let's say we are developing a simple web-app which tries to autocomplete the name of the countries that we are typing - We would code it as such. To overcome this, we are working on a browser extension Interceptor, which lets you define your own response, and everytime the browser requests data from a particular URL, returns you with mock data instead of, from the server. We, front-end developers resort to techniques like storing the data in a variable or using mock API's. Even after the API is given, if the front-end team wants a different set of data to work on, they again need to wait for the changes to be made and hosted. During development, often times front-end devs have to wait for the back-end devs to offer an API to work on.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |