Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
After inserting a record to a MySQL database I want to view a message that the record adding is successful by not using .php but using JavaScript. I want to do that to view the message in the client's side i.e the web browser.
Posted
Comments
Sergey Alexandrovich Kryukov 23-Feb-12 3:18am    
Why? How Javascript can know your MySQL data? Do you really understand what Javascript does? I'm not sure.
--SA
Chiranthaka Sampath 23-Feb-12 6:09am    
After insert one record gives '1 record added' message in php. But I want to display that message like a message box using javascript(an alert).

Ajax[^] is your friend!

No matter what, you will have to handle the database interactions in the server side, i.e. using PHP.

You will have to invoke the database operation using a Javascript HTTP request, and make the PHP code in server do the real operation in the database. After that, send the result back to the client as the normal HTTP response. And then you can display a nice little message box to the user using Javascript.

But, forget everything and read that tutorial I gave you, (if you don't know about Ajax, of course). And you'll find a way doing it then.
 
Share this answer
 
Ok pals I got the solution by my self. The solution is mentioned at the bottom.


echo ' javascriptfunction(); '

?>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900