Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

80
Views
Update Front End HTML with Back End API Data Conflict

So I have this delivery app and in order for me to get the delivery fee, I need to manually type the address and then submit the form so that the API can get the info and auto calculate the delivery fee.

In my HTML I have the basic setup

<p id="foodTotal">Food Total $0.00</p>
<p id="fee">Delivery Fee $0.00</p>

So when I choose my food items to order, my JS updates the HTML for the food total and would display

Food Total $10.00 //example

However, my delivery fee I don't know how to update this value since it is not something I can just code in Javascript and write like below because the fee is only calculated after I type in my address info.

document.getElementById("fee").textContent = `Your order total is: ${(fee)}`

Note I am using express to collect my form data and update the API

In my app.post function I am using an SDK and code looks like this. Note I don't have to put the fee value in my response since that is already auto calculated by the api, so adding fee: .... does nothing because I can't manually update that value, only the API can change it based on the address distance.

app.post(
  "/https://openapi.doordash.com/drive/v2/deliveries",
  async (req, res) => {
    const client = new DoorDashClient(
      {
        developer_id: process.env.DEVELOPER_ID,
        key_id: process.env.KEY_ID,
        signing_secret: process.env.SIGNING_SECRET,
      },
   );

    const response = await client.createDelivery(
      {
        external_delivery_id: uuidv4(), // keep track of the generated id here or in the response
        pickup_address: "Address 123 XYZ Street",
        pickup_phone_number: "+18001234567",
        dropoff_contact_given_name: req.body.dropoff_contact_given_name,
        dropoff_address: req.body.street + req.body.city + req.body.zipcode,
        order_value: req.body.item1,
      },
    );

So when I run node index.js I get all my data in my console showing exactly the fee, order_value, address etc... and I can also display this data onto another page after submitting by including simple html below my function.

However, I don't see how I would be able to update the first page of my app with the delivery fee automatically without manually submitting the form info first?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!