php - 不允许使用 jquery 方法

标签 php asp.net jquery html iis

怎样才能让这个页面在IIS服务器上运行... 它在本地主机上不起作用......当我直接打开它时它可以工作......它给出错误“不允许......!

The working Example..! I want this.. “”

错误:alt text

<html>
<head>

<script src="jquery.js" type="text/javascript" language="javascript"></script>
<script src="jquery.xml2json.js" type="text/javascript" language="javascript"></script>


<script>
function sayHello(msg)
{

   alert(msg);
}

function dcSetRate(obj,value){

document.getElementById(obj).value = value.toFixed(4);

}

function dcSet(obj,value){

document.getElementById(obj).value = value;

}

(function(usedUrl) {
   //All currencies quoted against the euro 
    var fetchService = function() {

    /*USD/RUB
EUR/RUB

USD/EUR
USD/TL*/
                $.get('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml', function(xml) {
                      var jsonObj = $.xml2json(xml);

                        //alert(jsonObj.Cube.Cube.Cube[0]["currency"] + 2);
                        var usd=jsonObj.Cube.Cube.Cube[0]["rate"];
                        var rub=jsonObj.Cube.Cube.Cube[16]["rate"];
                        var eur= 1 //jsonObj.Cube.Cube.Cube[1]["rate"];
                        var ytl=jsonObj.Cube.Cube.Cube[17]["rate"];

                        var usd_rub= rub/usd;
                        var eur_rub =rub/eur;
                        var usd_eur = eur/usd;
                        var usd_ytl= ytl/usd;
                        dcSetRate("USD_RUB",usd_rub);
                        dcSetRate("EUR_RUB",eur_rub);
                        dcSetRate("USD_EUR",usd_eur);
                        dcSetRate("USD_YTL",usd_ytl);
                }); 
getMicex();
                // assuming your elements are <img>
                document.getElementById("text1").value = getDt();
                // if not you could also set the background (or backgroundImage) css property
                // document.getElementById(elements.shift()).style.background = "url(" + images.shift() + ")";
                ///sayHello(usedUrl);

            setTimeout(fetchService, 10500);

        }

    window.onload = fetchService;
}(['URL URL']))

function getMicex(){

$.get('http://www.micex.com/issrpc/marketdata/stock/index/daily/short/result.xml', function(xml) {
                      var jsonObj = $.xml2json(xml);
                      var indexValue = jsonObj.row["CURRENTVALUE"];
                     dcSet("Micex",indexValue);
                      });
}

function getDt(){
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
if (minutes < 10){
minutes = "0" + minutes
}
var ama;
if(hours > 11){
ama ="PM";
} else {
ama ="AM";
}
 return hours + ":" + minutes + " : " + seconds + " " + ama;
}
</script>
</head>
<body>
 <input type="text" name="fname" id="text1"/><br/>
   USD_RUB<input type="text" name="fname" id="USD_RUB"/><br/>
   EUR_RUB <input type="text" name="fname" id="EUR_RUB"/><br/>
    USD_EUR <input type="text" name="fname" id="USD_EUR"/><br/>
    USD_YTL  <input type="text" name="fname" id="USD_YTL"/><br/>
        Micex<input type="text" name="fname" id="Micex"/><br/>
</body>
</html onLoad="sayHello()">

最佳答案

如果没有更多详细信息(例如精确的错误消息),很难从您提供的代码中判断错误可能是什么。

但是,查看您的代码,最可能的原因是您正在尝试跨站点 AJAX 请求。出于安全原因,仅允许向提供网页的同一服务器发送 AJAX 请求。 IE。在 example.com 的网页上运行的脚本只能向 example.com 的其他页面发出 AJAX 请求。例如,对 example1.com 或 example.net 的请求将被禁止。

您可以在这里阅读更多相关信息:http://en.wikipedia.org/wiki/Same_origin_policy

关于php - 不允许使用 jquery 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3722216/

相关文章:

php - 如何使用 native joomla 2.5 php 对象显示 Joomla 数据库表

php - 无法使用正确的变量

php - 如何使用 "every first thursday in month"获取 DatePeriod?

c# - Visual Studio 2010 为 .NET 3.5 ASP.NET 应用程序启动 .NET 2.0 开发服务器

c# - 使用 dt.select 填充下拉列表

php - 从复杂的嵌套 JSON 对象获取数据(使用 PHP)

ASP.NET MVC,_ViewStart.cshtml 内容

javascript - 表单中 Kendo Grid 内的下拉菜单 > 添加新记录创建未初始化的单元格

jquery - odometer.js 的多个实例

javascript - ChartNew 不显示项目图例