Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript/Ajax/flashhttp请求_Javascript_Ajax_Flash_Http - Fatal编程技术网

JavaScript/Ajax/flashhttp请求

JavaScript/Ajax/flashhttp请求,javascript,ajax,flash,http,Javascript,Ajax,Flash,Http,我得到了如下代码: swfobject.embedSWF("/Content/open-flash-chart.swf", "my_chart", "750", "300", "9.0.0", "expressInstall.swf", {"data-file":"http://localhost:8

我得到了如下代码:

swfobject.embedSWF("/Content/open-flash-chart.swf", 
                   "my_chart", 
                   "750", 
                   "300",
                   "9.0.0", 
                   "expressInstall.swf",
{"data-file":"http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123&param2=456"}
);
http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123
结果是,除了第一个参数外,总是在没有任何附加参数的情况下发出请求。。因此,请求如下所示:

swfobject.embedSWF("/Content/open-flash-chart.swf", 
                   "my_chart", 
                   "750", 
                   "300",
                   "9.0.0", 
                   "expressInstall.swf",
{"data-file":"http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123&param2=456"}
);
http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123
知道为什么不使用所有其他参数吗?我至少希望调用中有一些损坏的参数,但它只是被删除了


谢谢

您是否尝试切换参数以查看是否得到相同的结果?编码可能有问题。如果您列出正在使用的一些实际参数,可能会有所帮助。

您需要对传递给swfobject的FlashVar进行url编码——因此url编码整个数据文件url(在您根据需要对url中的任何单个参数进行url编码后):


如题为“停止!并阅读此…”的“打开flash图表”部分所述,您必须对传递到swfobject的参数进行url编码

您可以在脚本中执行以下操作:

swfobject.embedSWF("/Content/open-flash-chart.swf", 
               "my_chart", 
               "750", 
               "300",
               "9.0.0", 
               "expressInstall.swf",
{"data-file": encodeURIComponent("http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123&param2=456")}
);
您需要确保对传递给swfobject的所有值进行编码,因此确保将编码添加到将来添加的任何值中


干杯。

除非您的计数有输入错误,否则您应该删除变量名周围的引号

//not this
{"data-file":"http://localhost:8803/"}

//this
{dataFile:"http://localhost:8803/"}
让我知道这对你是否有效

编辑


哎呀!没有正确阅读,是的,总是url编码参数。

是的,已经尝试过了。。。我个人猜测这与&-字符有关。。。但是我应该如何解决这些问题呢?看起来这里并没有使用变量。尝试使用单引号。