Title: Access PD Database Fields in JavaScript code
Last modified: September 16, 2024

---

# Access PD Database Fields in JavaScript code

 *  Resolved [bob1500](https://wordpress.org/support/users/bob1500/)
 * (@bob1500)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/)
 * I would like to use 2 fields from my database, house_number and street_name to
   insert into JavaScript code that creates a URL to search a county property records
   website. Our HOA is using a Participants Database to store homeowners’ property
   and contact information. We need to access the county property records to obtain
   the current mailing address for properties. This may differ from the homeowner’s
   street address. I live in a resort area and many people here have second homes,
   with their primary home being elsewhere. My idea is that after a search, at the
   end of the pdb_single page I could place the JavaScript code that would use the
   returned house_number and street_name and, upon pressing a button, launch the
   URL to search for the corresponding record in the county property records where
   the homeowner’s mailing address is stored. Can anyone help with this idea?
 * Thanks,
   Bob

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [bob1500](https://wordpress.org/support/users/bob1500/)
 * (@bob1500)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/#post-18021270)
 * Here is a screenshot of what I am trying to do. House Number and Street Name 
   are displayed from a Participants Database record search. I want to have these
   fields copied to the corresponding search fields below which will then find the
   property record in the Larimer County property records website. I can manually
   enter the House Number and Street Name in the JavaScript search fields, but would
   rather have it be done automatically.
 * ![](https://i0.wp.com/www.carriagehillspoa.org/wp-content/uploads/2024/09/Participant-
   Info-Screen.png?ssl=1)
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/#post-18023367)
 * Generally, this is too complicated a request to be answered in a support forum.
   You’ll need to get the help of a WordPress developer to implement something like
   this.
 * Strictly speaking, you won’t need javascript for this, the info request can be
   handled in the backend much more efficiently, plus the result can be stored so
   the request doesn’t have to happen every time a record is displayed.
 *  Thread Starter [bob1500](https://wordpress.org/support/users/bob1500/)
 * (@bob1500)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/#post-18023380)
 * Regarding your comment, “Strictly speaking, you won’t need javascript for this,
   the info request can be handled in the backend much more efficiently, plus the
   result can be stored so the request doesn’t have to happen every time a record
   is displayed.”
   Can you give me a hint of where to go to find out how to do this?
   Creating an html field is one idea I have had, if I can insert fields from the
   PD database record (i.e. house_number and street_name) into the resulting html
   statement.
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/#post-18025515)
 * An operation like you’re asking about can be pretty tricky to implement because
   you need to get information from another server. This can often take some time,
   so the request needs to be made asynchronously so that it doesn’t hold things
   up while the php script is waiting for the response. Since this is fairly technical,
   I suggest you find a WordPress developer to help you.
 * If you’re interested to see the function that you would use to get the remote
   information, take a look at the [WP_Http](https://developer.wordpress.org/reference/classes/WP_Http/request/)
   class methods.
 * As to adding the value to the record, you would probably use a regular text field
   to receive the data from the remote server. This is typically done when the record
   is created or updated using a hook like [_pdb-after\_submit\_add_](https://xnau.com/work/wordpress-plugins/participants-database/participants-database-documentation/participants-database-api/#hooks)
   or _pdb-after\_submit\_update_. The code is executed on the hook, then when the
   response comes back from the server, the record is updated with the content of
   that response. It’s best not to try to get the external data when the record 
   is displayed, this could result in a slow page load.
 *  Thread Starter [bob1500](https://wordpress.org/support/users/bob1500/)
 * (@bob1500)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/#post-18025736)
 * Thank you for the suggestions. I recognize that this goes beyond the scope of
   the usual questions on this forum. If I come up with something that could be 
   useful to others I will post it back to this forum. We can close out this thread.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Access PD Database Fields in JavaScript code’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [bob1500](https://wordpress.org/support/users/bob1500/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/access-pd-database-fields-in-javascript-code/#post-18025736)
 * Status: resolved