如何从 jquery-ui 对话框更改数据库中的数据?
我是新手,我想从 jquery-ui dialog 更改我的数据库数据。 我应该在对话框脚本中添加哪些代码,以便在连接到数据库之前连接到进程页面?
i'm newbie,i want change my DB data from jquery-ui dialog.
What code should I add to the dialog script that can make me connecting to process page before connecting to DB?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在你的 jquery-ui 对话框中,你应该有一个按钮,当你按下它时,它会更新数据库表中的一行。为了做到这一点:
- 创建一个按钮,当按下它时,它将触发对 php 文件的 ajax 请求:
- 在你的 php 文件中,你将有一个更新数据库表中的行的脚本:
这是一个非常简单的示例,我建议阅读以下教程:
http://php4every1.com/tutorials/jquery-ajax -教程/
In your jquery-ui dialog you should have let say a button, and when you press it, it would update a row in a database table. In order to do it:
-Create a button, and when pressed it would trigger an ajax request to a php file:
-In your php file you would have a script updating the row in the database table:
This is a really simple example, I would recommend reading the following tutorials:
http://php4every1.com/tutorials/jquery-ajax-tutorial/
我不确定你是否理解你所问的问题。 JavaScript不能直接修改服务器上的数据,它需要通过向服务器传递数据来调用服务器上的 PHP、C#、Perl 或其他脚本。然后,该服务器端脚本会修改您的数据库。
如果是 PHP,您的 Javascript 可能会发出包含以下内容的 POST 请求:
name=Dave&phone_number=12345
您的 PHP 脚本将使用
$_POST['name']
和$_POST['phone_number']
访问该数据并将其发送到数据库。我会推荐一些背景阅读,例如:动态应用程序开发-Using-MySQ 或 Web-Application-Architecture-Principles-Protocols< /a> 或 PHP-MySQL-Dynamic-Web -站点和jQuery 的实际应用< /a>
I am not sure you understand the question you are asking. Javascript can't directly modify data on your server, it needs to invoke a PHP, C#, Perl or other script on the server by passing data to it. This server-side script then modifies your database.
If it were PHP your Javascript might make a POST request containing:
name=Dave&phone_number=12345
Your PHP script would then use
$_POST['name']
and$_POST['phone_number']
to access that data and send it to the database. I would recommend some background reading such as:Dynamic-Application-Development-Using-MySQ or Web-Application-Architecture-Principles-Protocols or PHP-MySQL-Dynamic-Web-Sites and jQuery in action