Where to store search settings?

  • 0
    The method requests data from the server, the server returns a JSON object with data about the previously performed search, search parameters.

    There can be several searches in the project, in different sections, so the JSON looks like this:

    et res = {"search1": {...parameters}, "search2": {...parameters}}

    The question is, how and where to store these settings so that you can extract search parameters and set them?

    Should I create a structure class Search {}, class Search1 extends Search {} , where to store the data? Suppose so, then where to store the Search objects? To make it easy to work with them, to wrap them in a facade?
    JavaScript Anonymous, Apr 5, 2020

  • 1 Answers
  • 0
    Easier - shove it into data-src in the search field.

    searchField.setAttribute ('data-src', res);
    Blake Nunez

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!