<% license_use" />
      <% license_use" />
        <% license_use"/>
        DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        fastify searching data from postgresql

        58 Views Asked by user3227899 At 23 October 2023 at 13:38 2025-12-17T10:33:06.751656

        login.ejs has following code

        <input type="text" name="addUser_license" id="addUser_license" />
        
        <!-- Display the search results -->
        
        <ul>
          <% license_users.forEach((user2) => { %>
          <li><script> console.log("<%- user2.license_key %>");</script></li>
          <% }) %>
        </ul>
        

        and my ajax code is

        $("#addUser_license").blur(function () {
                let myTxt = $(this).val();
                var formData = {
                  "license_key": myTxt,
                };
                $.ajax({
                  type: "POST",
                  dataType: "JSON",
                  url: "/license",
                  data: formData,
                })
                  .done(function (response) {
                    console.log("Success: " + response.msg);
                    console.log(data);
                  })
                  .fail(function (response) {
                    console.log("Error: " + response.msg);
                    console.log(myTxt);
                    console.log(formData);
                  });
              });
        

        and my post request of server side is

        fastify.post("/license", async (request, reply) => {
          const client = await fastify.pg.connect();
          const { license_key } = request.body;
          try {
            const result = await client.query(
              'SELECT * FROM license WHERE license_key LIKE $1',
              [license_key]
            );
        
            // Pass the search results to the EJS template
            reply.view( "/login.ejs", { license_users: result.rows } );
            console.log(result.rows)
            console.log(license_key)
          } catch (err) {
            console.error(err);
            return reply.view("error.ejs");
          } finally {
            client.release();
          }
        });
          
        

        following error occcur:

        Error: undefined
        

        and this line not works. Didn't any request to return

        <li><script> console.log("<%- user2.license_key %>");</script></li>
        

        and following console results fine show

        console.log(result.rows) console.log(license_key)

        i think this line not works properly

        reply.view( "/login.ejs", { license_users: result.rows } );
        

        But i don't know why this not working? what should i do?

        jquery ajax postgresql search fastify
        Original Q&A
        0

        There are 0 best solutions below

        Related Questions in JQUERY

        • How to sort these using Javascript or Jquery Most effectively
        • Ajax jQuery firing multiple time display event for the same result
        • .hover() seems to overwrite .click()
        • Check for numeric value with optional commas javascript
        • Extending Highmaps Side Effect
        • Array appending after each onclick and loop in javascript
        • how can i append part of a table based on how many tr it has?
        • Play multiple audio files in a slider
        • Remove added set of rows
        • Access property of an object of type [Model] in JQuery
        • AJAX PHP - Reload div after submit
        • proengsoft/laravel-jsvalidation ReferenceError: jQuery is not defined
        • when a checkbox is checked how to display a different hidden element using javascript
        • Get jquery error Uncaught RangeError: Maximum call stack size exceeded
        • Removing only the closest thead on table filtering

        Related Questions in AJAX

        • Ajax jQuery firing multiple time display event for the same result
        • Implement Onfailure in webApi controller
        • AJAX PHP - Reload div after submit
        • ajax load data from mysql
        • Ajax-update only a component attribute, not the whole component nor its children
        • using ajax to get a php database result and then show the result in a button
        • How to prevent browser from executing some JavaScript when person clicks Back button?
        • ajax async: true statement execution order
        • Rails 4.2 jQuery loads only after refresh
        • WebForms GET Json requests (JsonRequestBehavior.AllowGet)
        • Rails - Ajax do not work properly on production server
        • Angular js Button click
        • Make jQuery/AJAX perform instantly on page load
        • jQuery Ajax Uncaught TypeError: Cannot use 'in' operator to search
        • Show success or error messages in Ajax response to Wordpress custom registration form

        Related Questions in POSTGRESQL

        • Why does adding a JOIN completely modify the query planner behaviour?
        • When dealing with databases, does adding a different table when we can use a simple hash a good thing?
        • Aggregate and count in PostgreSQL
        • Rails HABTM: Select everything a that a record 'has'
        • Trigger using data from inserted row
        • Select results where joined table contains records with an attribute, but without another
        • DB candidate as CouchDB/Schema replacement
        • How do I properly add data in SQLAlchemy?
        • Postgres in Conda Environment (Ubuntu 14.04)
        • How to customize the output of the Postgres Pseudo Encrypt function?
        • Split a large query (2 days) into pieces to increase the speed in Postgres
        • Why does pg_search prefix not work like I expect?
        • extracting meta info from a table psql using information_schema
        • How to query a table in the database and copy it's data into one one?
        • Update a table using info from a second table and a condition from a third table in Postgresql

        Related Questions in SEARCH

        • SQL weight rows by formula
        • If Input is focused trigger X else trigger Y
        • laravel full-text search with multiple keywords together
        • Login form by using a new database, made in VB
        • How to search for overloaded methods in a class
        • Modifying Tries code in Java
        • Doing a multi-column search for an item in a listView control using c#
        • T SQL wildcard searching for a zip code
        • django rest framework search filter all fields
        • how to filter search result with dropdown list in php
        • PHP/MySQL search... show all data by default, or show matched data
        • Oracle multiple REPLACE options in REGEXP_REPLACE
        • Is there a way to get all complete sentences that a search engine (e.g. Google) has indexed that contain two search terms?
        • How to search a unknown composite key for dictionary in O(1) in c#
        • android java search listview clickedItem

        Related Questions in FASTIFY

        • Implementing load protection for Fastify Node js
        • Transform response of fastify-static served files
        • Node.js - Fastify: Connection closed during sleep (setTimeout)
        • Fetch image from azure-blob and send it to client without saving locally using node server
        • When using fastify-session and fastify-webockets, how do I get access to the session?
        • Where does secure-session store session data?
        • Typescript API contract, type instantiation is excessively deep and possibly infinite
        • How to customize an errors with Fastify, Ajv and Schema?
        • How to format fastify logs as logfmt
        • Erros in fastify lib using ajv
        • How to resolve asynchronous function it's not returning data in time when fastify sends the request
        • fastify schema cannot read nested objects
        • fastify searching data from postgresql
        • Fastify is giving me an error I cannot find where im fulfilling a promise with undefined
        • Submission error! response.header is not a function in nest-fastify graphql

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?
        .

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Math
        • Aftereffectstemplates