Connect/Load Postal Data

HyperOsmar

Member
Hi All,

In Brazil we use the CEP (postal address code), similar to the ZIP used in other countries...
Our Correios service provides an API to access the DB and return the desired fields...

How should I load the API in a form and when the user enters the zip code the other fields are loaded automatically???...

I searched the Forum and didn't find anything that could help me...

Attached is the file containing the API...

I'm using:
Joomla - 3.9.28
Fabrik - 3.9.2
MySQL - 5.7.23
PHP - 7.4.16
 

Attachments

  • api_correios.txt
    4.5 KB · Views: 28
In more detail, something like this would be an option:

1) For your CEP (field) element add "blur" event (js/jQuery code in form_xx.js).
2) Inside blur event pass the CEP code to PHP function in user_ajax.php with ajax call.
3) In user_ajax.php use cURL functions to get the address data from the API and pass it back to form_xx.js.
4) In form_xx.js ajax call's "done function" update the necessary field(s) on you form with the data returned from the ajax call.
 
Last edited:
Hi @juuser,

First of all thank you for the feedback but, despite the detail, I could not understand your step-by-step.
I apologize for my lack of skill...
Even so, I reiterate my thanks...
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top