I am using swift 4.2 so I am not sure if my code is outdated because many of the examples are not for the latest.
I have been trying many of the examples I have found here on stack but it seems they are outdated because of many references not valid working anymore.
I am trying to get the innerText of an element with a particular ID. Unfortunately I produce no results in successfully getting the value. Then I am trying to take result
and put it in Firebase. If I use something like "test"
instead of result
it works fine, but I need result
Here is my code.
override func viewDidLoad() {
super.viewDidLoad()
ref = Database.database().reference()
webView.evaluateJavaScript("document.getElementById('get_this_user').innerText") { (result, error) in
self.ref?.child("users").child("usernames").setValue(["get_this_user": result])
}
}