简体   繁体   English

Codeigniter中的一个HTTPS ajax调用

[英]One HTTPS ajax call in codeigniter

I am trying to create a secure login for my site, who's form logs in with AJAX. 我正在尝试为我的站点创建安全登录名,该站点的表单使用AJAX登录。 Unfortunately, as it currently stands, I am sending the username and password using http completely unencrypted. 不幸的是,按照目前的情况,我使用完全未加密的http发送用户名和密码。 After looking through basic encryption methods in Javascript that I can port to Codeigniter to decrypt, I've read that the best thing to do is just use HTTPS to send the data. 在研究了可以移植到Codeigniter的Javascript中的基本加密方法之后,我读到最好的方法就是使用HTTPS发送数据。 So basically what I want to do is this: 所以基本上我想做的是:

  1. Someone fills out their credentials on my site. 有人在我的网站上填写了他们的凭据。
  2. The data gets ajaxed to https//:MY-SITE.com/ajax/login 数据被发送到https //:MY-SITE.com/ajax/login
  3. It responds as normal. 它响应正常。

Unfortunately, when I set this up, my AJAX function that had been working when using http stopped sending the response it was supposed to send. 不幸的是,当我进行设置时,使用http时一直在工作的AJAX函数停止发送应该发送的响应。 Do I need to do something extra to get my AJAX function properly read with codeigniter using HTTPS? 我是否需要做一些额外的事情才能使我的AJAX函数通过HTTPS通过codeigniter正确读取?

You can't request information between HTTP and HTTPS using AJAX due to cross-domain issues. 由于跨域问题,您无法使用AJAX在HTTP和HTTPS之间请求信息。 To get this to work, consider implementing JSONP as part of your login script. 为了使其正常工作,请考虑将JSONP作为登录脚本的一部分来实现。 This way, you can perform the login between domains. 这样,您可以在域之间执行登录。

jQuery has a great JSONP implementation; jQuery具有出色的JSONP实现; it's worth checking out if you're not using it already. 值得检查一下是否还没有使用它。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM