Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

How to insert records into a database and print them once inserted?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some drop downs where the user makes selections of car make, model, year, mileage and son on, and text boxes where they enter the price of the car, market value, book value and so on and it automatically updates the total market value. When the user clicks the add button to add the car information into the database  I want to have an alert message which asks the user if they want to print an invoice with all the details. My code so far inserts the records correctly into the database but I don't get the alert message to allow the user to print.

JavaScript



All the help is appreaciated, ad thank you in advance.
 
Saloon Keeper
Posts: 11189
244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know if the success function is being called at all? Have you tried printing the data from the server to console? You can also try adding a complete function to the ajax call to see what the status code of the response was.

Note that it's a bad idea to have you database code so tightly coupled with your request handling code. Have you already looked at an MVC framework like Laravel?
 
elg Goncalves
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Stephan I am not sure if the success function is being called, I am a bit new when it comes to ajax and linking it with the server side. since I don't get the alert message I doubt it is being called but I am not sure how to fix that issue.

I haven't looked at any MVC framework as yet, but i will take a look at it, thank you for the tip.
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!