/    Sign up×
Community /Pin to ProfileBookmark

Javascript function return value as parameter of PHP script in HTML

I have to call PHP script, that returns SVGZ or VMLZ image.
Script have

<head>
<script type=”text/javascript”>
function supportsXXX() {
….
}
</script>

<object data=”my.php?param1=<supportsXXX return value>”
type=”image/svg+xml”>
</object>

<supportsXXX return value> -????

This function should be called only once after page load.
Is not it?

If i want to add some parameters, that user can change on HTML page, how can I call without page reload?

I am a new-bie in Ajax.

Thank you.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@hellboyauthorMay 25.2009 — I have Smarty template:

{literal}

<script type="text/javascript">

// Prüfen, ob Browser VML unterstützt

function supportsVml() {..}

function supportsSvg() {..}

function init()

{

var obj = document.getElementById('map');

var obj_data = ...;

var obj_typ;

if (supportsSvg())

{ ...

obj_typ = 'image/svg+xml';

}

else if (supportsVml())

{ ...

obj_typ = 'application/vnd.openxmlformats-officedocument.vmlDrawing';

}

obj.data = obj_data;

obj.type = obj_typ;

}

</script>

{/literal}

....

<object id="map" data="" type="">

</object>

There are 2 problems:

1) Firefox 3: OK, but if user returns back to this page - object dimensions are not corret (too small).

user must reload this page.

2) Internet Explorer 8 (and may be 6, 7) -

obj.type = obj_typ; - property can not changed in run-time mode.

Main aim: return vector graphics: in VML format for IE or SVG for Opera or Firefox?
×

Success!

Help @hellboy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...