简体   繁体   English

使用django / javascript保存DnD状态

[英]Save DnD state with django / javascript

I am doing a javascript program to drag and drop users in groups. 我正在做一个javascript程序来拖放组中的用户。 I want save the configuration of users and groups in the db. 我想在db中保存用户和组的配置。 If I can make a post request, I will do this save easly in a view. 如果我可以发帖子请求,我会在视图中轻松保存。

So, I have thought to create a post request in javascript, is it possible, safe ? 所以,我曾想过用javascript创建一个post请求,这样可能,安全吗?

Is there any better possibility with django ? django还有更好的可能性吗?

Are you using jQuery? 你在使用jQuery吗? If so check this out: http://api.jquery.com/jQuery.post/ 如果是这样,请查看: http//api.jquery.com/jQuery.post/

you can call something like this: 你可以这样打电话:

$.post('script_to_run.php?infotosave=3');

And then you create the 'script_to_run.php' file to query your database and store any information that you need to. 然后创建'script_to_run.php'文件来查询数据库并存储您需要的任何信息。

You can do it with just javascript (no jQuery) but it is much simpler with jQuery 你可以用javascript(没有jQuery)来做到这一点,但使用jQuery更简单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM