JavaScript请求数据库URL [英] JavaScript request database URL

查看:179
本文介绍了JavaScript请求数据库URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

评论代码将受到高度赞赏



开发人员想要更新数据库并向用户显示消息而不刷新页面。他基本上会使用AJAX。假设您有以下PHP代码片段,用于查询MYSQL数据库并存储在



http://mydomain.com/update.php

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

mysql_query("UPDATE table_name WHERE column_name = ‘$var’") ;

echo "Database successfully updated" ; 

?>





制作一个AJAX请求(如果需要,可以使用JQuery)从上面的URL中检索数据。

将ID =message的div元素更改为AJAX调用的响应。



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.

推荐答案

var' );

echo 数据库已成功更新;

?>





发出一个AJAX请求(如果需要,可以使用JQuery)从上面的URL中检索数据。

将ID =message的div元素更改为AJAX调用的响应。



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.


这看起来像是作业。



如果你自己做作业最好。这是给你的你会学到一些东西,想想已经教过的东西。阅读你的教科书并试一试。



一旦你有代码并遇到问题你就可以随时回到这里,提出一个更具体的问题,社区将竭尽所能为您提供帮助。 t忘记仅发布造成问题的相关代码位,因为代码转储通常对帮助/协助您没有帮助。



祝你好运和快乐的编码。
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.


这篇关于JavaScript请求数据库URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆