| | TimeClypse 05-31-2005, 03:11 AM I embedded a SVG object into my php page using the following code:
<object data="../../RIMapper/XML2SVG?RIM=aamsveen_groundwaterpoints.xml&validate=on" type="image/svg+xml" width="600" height="600" align="middle">
<a href="http://www.adobe.com/svg/viewer/install/beta.html"><img src="images/svgdownload.gif" width="600" height="600" align="middle"></a>
</object>
I'm using the following code to return a variable, when you click the SVG object:
<FRAGMENT DBID="none" NAME="showRIMData" TYPE="ECMASCRIPT">
function showRIMData(evt,theNS, theElem) {
if (theNS != '') { theElem = theNS + ":" + theElem; }
alert(evt.getTarget().getAttribute(theElem));
}
</FRAGMENT>
I don't want the alert function, but i want to POST that variable displayed by the alert function to another php page, which uses this for further processing.
How to manage this so that i can POST that variable to the required php page?
I tried PostURL, and GetURL, but in some way i cant get those two working! :o Anonymous 05-31-2005, 03:41 AM You can use
postURL("your_file.php",evt.getTarget().getAttribute(theElem),callback,"text",null)
To retrieve data in your_file.php
$data = $HTTP_RAW_POST_DATA;
In callback function you can know what happen for your call
function callback(data)
{
if (data.sucess)
................
You can also use data.content returned by your_file.php ...
Michel Anonymous 05-31-2005, 04:30 AM You can use
postURL("your_file.php",evt.getTarget().getAttribute(theElem),callback,"text",null)
To retrieve data in your_file.php
$data = $HTTP_RAW_POST_DATA;
In callback function you can know what happen for your call
function callback(data)
{
if (data.sucess)
................
You can also use data.content returned by your_file.php ...
Michel
This doesnt seem to work either..
i think the problem for me is that i embedded the SVG into the PHP file, where to it has to post too!
I made a script to retrieve values from a SQL database, when clicked on the SVG.
So when i click in the SVG:
- the SVG retrieves the value from the SQL database (evt.getTarget().getAttribute(theElem)
- the SVG sends a variable to the same php page
- the php retrieves the values sent by the SVG, and uses them for further processing in displaying a webpage
I dont see any action either, so i dont think it posted well, or the SVG doesnt load the new page very well
This is the code i used:
<FRAGMENT DBID="none" NAME="showRIMData" TYPE="ECMASCRIPT">
function showRIMData(evt,theNS, theElem)
{
if (theNS != '') { theElem = theNS + ":" + theElem; }
function callback(data)
{
if (data.success) {
alert("success");
}
else {
alert("no success");
}
}
postURL("gima.php",evt.getTarget().getAttribute(theElem),callback,"text",null);
}
</FRAGMENT> TimeClypse 05-31-2005, 04:32 AM Aye, i tried IE instead of mozilla
Got an alert: "no success".... hauke 05-31-2005, 05:45 AM I've had similar problems ones (http://www.learnsvg.com/forum/viewtopic.php?t=261)...
is there a reasonable hope, that the new SVG1.2 standard offers a more convenient solution to this problem of scripting communication? Anonymous 05-31-2005, 09:38 AM I've had similar problems ones (http://www.learnsvg.com/forum/viewtopic.php?t=261)...
is there a reasonable hope, that the new SVG1.2 standard offers a more convenient solution to this problem of scripting communication?
I see you got the window.location.href working? I can't get that working, not even in IE :(
As if i can get that working, my problem is solved too!
I changed the php file, so that it uses GET instead of POST variables
gima.php?gwpid=6
This works too for submitting variables, so only an "open url" command will work too... I can let the SVG create a specific url using the variables, so then a POST command is not needed..
But, I haven't found that yet :( TimeClypse 05-31-2005, 01:13 PM I've had similar problems ones (http://www.learnsvg.com/forum/viewtopic.php?t=261)...
is there a reasonable hope, that the new SVG1.2 standard offers a more convenient solution to this problem of scripting communication?
I see you got the window.location.href working? I can't get that working, not even in IE :(
As if i can get that working, my problem is solved too!
I changed the php file, so that it uses GET instead of POST variables
gima.php?gwpid=6
This works too for submitting variables, so only an "open url" command will work too... I can let the SVG create a specific url using the variables, so then a POST command is not needed..
But, I haven't found that yet :(
Is an open url command for Adobe's SVG Plugin available? TimeClypse 06-02-2005, 01:53 AM Well, partly fixed.
Use <EMBED> instead of <OBJECT>. Then change your script so it uses the $_GET variables instead of $_POST.
Let the SVG script "window.location.href" the url with the variables and.. VOILA! | |