Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Code with comments would be highly appreciated

A developer wants to update a database and display a message to the user without refreshing the page. He is essentially going to use AJAX. Suppose you have the following PHP code snippet that queries a MYSQL database and is stored at

http://mydomain.com/update.php
PHP
mysql_query("UPDATE table_name WHERE column_name = ‘$var’") ;

echo "Database successfully updated" ; 

?>


Make an AJAX request (JQuery if you want) to retrieve data from the URL above.
Change a div element with ID = “message” to the response of the AJAX call.
Posted
Updated 30-Nov-12 22:23pm
v3

1 solution

This looks like homework.

It would be best if you did your own homework. It is given to you so that you will learn something, think about what have been taught. Read your text books and give it a try.

Once you have code and run into problems you can always come back here with a more specific question and the community will do its best to help you. Don't forget to post only the relevant code bits that pose the problem as a code dump is not usually helpful at all in getting someone to help/assist you.

Good luck and happy coding.
 
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