AJAX调用需要用户名和密码 [英] ajax call needs username and password

查看:330
本文介绍了AJAX调用需要用户名和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个Ajax新手,这样或许可以解释我的问题。

I'm an Ajax newbie, so that might explain my question.

我做了以下调用

                   $.ajax({
                   url: '<?php echo site_url('something/somethingelse')?>',
                   type:'POST',
                   username: 'username',
                   password: 'password',
                   data: { parm1 : 'A', 
                           parm2 : 1,
                           parm3 : 2 }, 
                   dataType: 'json',
                   success: function(output_string){
                   }

用户名和密码是我用来登录到我的服务器的用户名和密码。

username and password are the username and password I use to sign into my server.

我怎样才能重新present他们的JavaScript安全?我知道我可以将它们存储在变量和使用Ajax调用中的变量 - 但变量将存在于一个JavaScript文件,可以看见任何人都可以使用一个调试器,使您可以查看JavaScript的谁

how can i represent them in the javascript securely? i know i can store them in variables and use the variables in the Ajax call - but the variables will exist in a javascript file and be visible to anyone who can use a debugger that allows you to view the javascript.

有没有办法隐藏某些javascript文件?它的JavaScript有一个属性相当于文件?

is there a way to hide certain javascript files? does javascript have the equivalent of a properties file?

推荐答案

原来,这是一个URL冲突。

turns out this was a url conflict.

Ajax调用正在访问一个网址,让我们some.domain称之为/统计

the ajax call was accessing a url, let's call it some.domain/stats

的托管服务提供商提供了受密码保护的免费统计页面。它的URL也some.domain /统计

the hosting provider offers a free Statistics page that is password protected. its url is also some.domain/stats

在我的应用程序访问some.domain /统计,直通一些奇怪的路由我不明白,我是针对保护功能的密码。

when my app accessed some.domain/stats, thru some weird routing I don't understand, I was directed to the password protected one.

当我改变了AJAX调用正在访问喜欢的东西some.domain的网址/ nameOtherThanStats则一切正常。

when i changed the url the ajax call was accessing to something like some.domain/nameOtherThanStats then everything worked fine.

无需htaccess的变化。

no htaccess changes needed.

这篇关于AJAX调用需要用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆