-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTTPRequest.gd
More file actions
29 lines (23 loc) · 1.1 KB
/
HTTPRequest.gd
File metadata and controls
29 lines (23 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
extends HTTPRequest
var my_full_url = "https://docs.google.com/forms/d/e/1FAIpQLScK8jJE9WbzeNVWCm4pY4HNabOQ9evnTZwK0qWTtuHJpxKR6A/formResponse";
var headers = ["Content-Type: application/x-www-form-urlencoded"]
# func _ready():
# send_data("Send this data to Google")
func send_data(feedback):
# Transform data so it can be sent:
var http = HTTPClient.new()
var headers_pool = PoolStringArray(headers)
var my_data = {"entry.852953439" : feedback}
var my_data_ready = http.query_string_from_dict(my_data)
# print(my_data_ready)
#Send data!!!!
var result = self.request(my_full_url, headers_pool, false, http.METHOD_POST, my_data_ready)
if result == 0:
print("Comment sent, thank you for your feedback")
get_parent().get_parent().get_node("TextEdit").text = "Comment sent, thank you for your feedback"
else:
print("Error sending data!")
# get_parent().get_parent().get_node("TextEdit").text = "Error sending data!"
func _on_Send_feedback_pressed():
var message = get_parent().get_parent().get_node("TextEdit").text
send_data(message)