从Laravel控制器调用Javascript函数并返回数据 [英] Calling Javascript function from Laravel controller and return data
问题描述
我想从我的控制器调用一个 firebase auth函数(使用Javascript),我希望返回的标记
返回到我的控制器,但我不知道该怎么做。
我知道如何发送 ajax
请求到控制器并获取数据,但是我不知道如何以相反的方式提出请求。
如果您能将我和其他用户放在正确的方向,我将会感激不尽。
这是不行的。
你知道一个网络服务器总是在线。这样,你总是可以提出请求。
客户端(用户),不是需要,并不总是在线。如果他们关闭浏览器窗口,则不能再与它们交互。服务器将很难检查用户刚刚失败,你有成千上万的用户。
打电话给web服务器是可能的,但做一个调用给客户端不是。
在这个原因之后,如果您能够向客户端发出请求,就会出现安全问题。
I want to call a firebase auth function (which is in Javascript) from my controller and I want the returned token
back in my controller, but I do not know how to proceed.
I know how to post ajax
request to controller and get data back, however I don't know how to make a request the other way around.
I would be thankful if you can put me and other future users in right direction.
This is not going to work.
You know a webserver is always supposed to be online. That way, you can always make a request.
A client-side (user), does not need, and isn't always online. If they close the browser window, you can't interact with them anymore. The server would have a hard time checking what user just went down, out of the thousands of users you have.
Making a call to a webserver is possible, but making a call to a client is not.
There are, next to that reason, security issues if you would be able to make a request to the client-side.
这篇关于从Laravel控制器调用Javascript函数并返回数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!