向后端传递数据的常规方法?

时间:2022-08-28 12:14:53

I'm fairly new to web development, so please pardon the painfully newbie question that's about to follow.

我对web开发相当陌生,所以请原谅我接下来要问的这个令人痛苦的新问题。

My computer science class group and I are developing a web application for class, which is built in Python (under Django) and uses jQuery on the front end. It's primarily an Ajax-ified application, and passing data from the backend to the front end is done through Ajax calls to specific URLs which return in the JSON format.

我和我的计算机科学类团队正在为类开发一个web应用程序,它是用Python (Django下)构建的,前端使用jQuery。它主要是一个Ajax化的应用程序,将数据从后端传递到前端是通过Ajax调用来实现的,这些url以JSON格式返回。

This is probably a stupid question, but what's the conventional approach for passing data in the opposite direction? We don't want to reload the page or anything, so is it an Ajax pass going the other way or something?

这可能是一个愚蠢的问题,但是传统的数据反向传递方法是什么呢?我们不想重新加载页面或其他内容,这是Ajax传递还是其他方式?

1 个解决方案

#1


3  

You simply send AJAX request and pack all the data to POST request params then read it in Django.

您只需发送AJAX请求并将所有数据打包到POST请求params中,然后在Django中读取它。

Example of basic voting app in django + ajax: http://lethain.com/entry/2007/dec/11/two-faced-django-part-5-jquery-ajax/

django + ajax中的基本投票应用程序示例:http://lethain.com/entry/2007/dec/11/two-faced django-part-5 jquery-ajax/

#1


3  

You simply send AJAX request and pack all the data to POST request params then read it in Django.

您只需发送AJAX请求并将所有数据打包到POST请求params中,然后在Django中读取它。

Example of basic voting app in django + ajax: http://lethain.com/entry/2007/dec/11/two-faced-django-part-5-jquery-ajax/

django + ajax中的基本投票应用程序示例:http://lethain.com/entry/2007/dec/11/two-faced django-part-5 jquery-ajax/