Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8353441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:15:39+00:00 2026-06-09T09:15:39+00:00

I was initially going to create a classic updates while you type Javascript based

  • 0

I was initially going to create a classic “updates while you type” Javascript based pension pot calculator but did not want the user to be able to see the business logic by downloading the .js file. However, there does not appear to be a robust way of protecting the business logic in the .js file.

Therefore, I am now going to put the calculation logic on the server in PHP. There is plenty of material out there with respect to creating a form which is submitted to another page that lists the outputs. However, my calculator is a side bar on the home page and I would like to user to click “calculate” and for the results to be displayed in the same box without being taken to a separate page.

Is this feasible and if so what would you suggest as the architecture of the solution? (e.g. keep calculation logic in .php and still call it via Javascript using xyz etc). Looking for guidance and design recommendations. The aim is a calculator with reasonably complex logic but no database lookups and most importantly the user must not be moved to a separate page.

Many thanks.
3rd August 2012

EDIT (17th December 2012): So four months later and I finally cracked it! Have a look at http://www.pencalc.org which demos what I was trying to build. Uses Javascript to asynchronously call a PHP based calculation. Thank you guys for all your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:15:40+00:00Added an answer on June 9, 2026 at 9:15 am

    knittl and sachleen were pushing you in the right direction, but I feel like a more complete answer is needed.

    If you don’t want to expose your business logic to your end-users, you can just use js/AJAX to automatically submit the form to a PHP script. The script then computes some value for the calculator, and then only prints the value (say, $20.45). You JS will eventually see the response from the PHP script. Once you have the value from the server, dump that value into the relevant field in the calculator. Now all the user can see is a bunch of JS which posts the user’s data to a PHP script.

    However, I would have a look at JQuery, which helps in automating a lot of the work of AJAX and anything that involves manipulating the DOM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Initially I thought this was going to work, but now I understand it won't
Initially I had designed this flash based navigation menu for my website, after going
Initially I deployed packages on SQL server but since my machine is not having
Initially I thought it was a CSS issue but I built a small sample
So initially I thought I wasn't going to need XIB files and can generate
I'm syncing with a MySQL database. Initially, I was going to loop through all
Before you react from the gut, as I did initially, read the whole question
This is going to be a little long and rambly, but I want to
Initially, this code was written to create pretty urls. When using the code below,
I created a slider But I am going some where wrong in my logic.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.