简体   繁体   English

将数据从 React 前端传递到 Django 后端

[英]Passing data from React frontend to Django Backend

I have a completed react app and I have a textarea and button in it and I want the textarea text to be passed to the django backend when the button is pressed.我有一个完整的反应应用程序,其中有一个 textarea 和按钮,我希望在按下按钮时将 textarea 文本传递到 django 后端。 In my folder, I have a React UI, Django project, along with a Django app inside of that project.在我的文件夹中,我有一个 React UI,Django 项目,以及该项目内的 Django 应用程序。 I know I have to use the django REST framework but I dont know how to pass the text from the React UI to the backend of Django.我知道我必须使用 django REST 框架,但我不知道如何将文本从 React UI 传递到 Django 的后端。

Sounds like a job for a form, to POST to the backend.听起来像是一份表格的工作,要发布到后端。 Or, an ajax POST after an onclick event.或者,在onclick事件之后的 ajax POST。

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

相关问题 使用 Django 和 React 将 API 数据从后端实时发送到前端 - Send API data from Backend to Frontend in real time with Django and React 将 pdf 从 Django 后端传递到 Angular 前端 - Passing a pdf from Django backend to Angular frontend 将前端与Django后端分离? - Decoupling Frontend from Django backend? 如何将数据从html(Django后端)发送到js(Vue前端) - How to send data from html (Django backend) to js (Vue frontend) Django:将数据从后端发送到前端而不刷新页面 - Django: Sending data from backend to frontend without page refresh Django 后端、React 前端和 CSRF Post - Django backend, React frontend and CSRF Post Json 来自后端,使用 Django Rest 框架在前端未定义,使用 React 构建 - Json from backend which is built with Django Rest Framework is somehow undefined at frontend, built with React 使用 axios 将当前登录用户从 Django 后端发送到 React 前端 - Send current logged in user from Django backend to React frontend using axios 无法从带有 Django rest 框架后端的反应前端访问 object 的“实例”或详细视图 - Cannot access "instance" or detail view of an object from react frontend with Django rest framework backend 从Django后端到React-Redux前端的对象JSON响应对象 - Object of objects JSON response from Django backend to React-Redux frontend
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM