Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • 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: 12022
257
  • 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.
 
Joel Salatin has signs on his property that say "Trespassers will be Impressed!" Impressive tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic