David
David

Reputation: 2571

JavaScript/Ajax/Flash HTTP Request

i got code like this:

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"}
);

The outcome is, that a request is always made without any additional parameter, except for the first one.. so the request looks like this:

http://localhost:8803/StatisticService/GetOpenFlashChartStatistic_Json?param1=123

Any ideas why all other parameters are not used? I would at least expect some damaged parameter in the call, but it's simply cut away.

Thank you

Upvotes: 1

Views: 2315

Answers (4)

enzuguri
enzuguri

Reputation: 828

unless there is a input mistake on your count you should remove the quotes around your variable name.

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

//this
{dataFile:"http://localhost:8803/"}

Lemme know if this works for you.

EDIT

Whoops! didn't read that properly, yes always url encode the params.

Upvotes: 0

coderjoe
coderjoe

Reputation: 11167

As mentioned in the open flash chart tutorial 3 section entitled "Stop! And Read This..." you absolutely must url encode the parameters being passed into swfobject.

You can do this as follows in your script:

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")}
);

You need to make sure to encode all values you pass to swfobject, so make sure to add the encode to any you add in the future.

Cheers.

Upvotes: 1

Justin Ludwig
Justin Ludwig

Reputation: 3435

You need to url-encode the flashvars that you pass to swfobject -- so url-encode the whole data-file url (after you url-encode any of the individual params in the url as necessary):

{"data-file": encodeURIComponent("/mydata?q=" + encodeURIComponent(x) + "&p=" + encodeURIComponent(y))}

See http://teethgrinder.co.uk/open-flash-chart-2/tutorial-3.php

Upvotes: 1

Allen Liu
Allen Liu

Reputation: 4038

Did you try switching the parameters around to see if you get the same outcome? There could be an issue with encoding. It may help if you list some of the actual parameters that are being used.

Upvotes: 0

Related Questions