Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About Nanonano

  • Rank
  1. Ok, thank you. I changed that line of code to: document.getElementById("new_svg_shape").data=xmlhttp.responseXML; which got rid of the error. Great!However nothing happens. The code returned from the UpdateSVGPage.php file is correct (when I check it in Firebug), but nothing happens on the image itself. The code doesn't render. I tried to use the <svg> tag instead of the <g> tag, where the code is returned to, but still nothing happens.Any ideas?
  2. Hello, and thank you for answering. As you suggested, I added content type to UpdateSVGPage.php, like this: <?php header('Content-Type: image/svg+xml'); //get the q parameter from URL $q=$_POST["input"]; echo "<rect x=\"1200\" y=\"233\" width=\"80\" height=\"20\" fill=\"blue\" />"; ?> Then I checked in "Firebug" what happens when the ajax_function() is called:- The parameter which is sent to the UpdateSVGPage.php file is correct, if I send it.- The response headers content type is image/svg+xml, and the request headers content type is text/html,application/xhtml+xml
  3. Hello. I am very stuck at one point in my web-page project, and I hope that anyone of you can help me. In short, I'm trying to achieve an AJAX-like effect in a SVG-document. What I mean is that when the SVG-document (in my example below called SVGPage.php) has finished loading and is just sitting there waiting, I want to use AJAX on the click of an SVG-element (in my example the rectangle) to send a request to an external PHP-file (in my example called UpdateSVGPage.php).This "UpdateSVGPage.php" is building up SVG-code based on information from a database, and it will echo it back to the SVG-d
  4. You were right, innerHTML does not work in SVG. I changed the code in my last post above, so now it's working when I return the AJAX-stuff to a SVG-text-tag. What I now need is a way to return pure SVG-code via AJAX, and put it somewhere inside the SVG-tags.So that new shapes are created after the AJAX-call.I've made an attempt under, but it doesn't seem to work as expected. I hope that someone can correct me. drawing.svg <?phpsession_start();header('Content-Type: image/svg+xml');print('<?xml version="1.0" standalone="no"?>');?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  5. Hello, and thank you for answering so fast! That could be an option when a shape is clicked it initiate a JS-function which took care of the AJAX business, but I think I tried that and couldn't figure out how to put the received data from the database into the right element. Could you help me with that line of code? *** Edited later, now working *** index.php <?php session_start(); ?><!DOCTYPE html><html> <head> </head> <body> <embed src="drawing.php" type="image/svg+xml" width="1000px" height="500px"/> </body></html> drawing.svg
  6. Ok friends: I'm totally stuck, and I desperately need some guidance from you professionals. For the last couple of months I've been working on a web-page project.This is what I've got so far: - I've got a HTML5 page (index.php)- In this HTML5 page, I've got an embedded SVG-file, which is converted to a PHP-file (drawing.php)- It is converted to PHP, because it uses some data in a database to decide what the SVG-image should look like.- In this SVG-file, a PHP-script builds some graphics, and applies some animations to it.- The SVG-file also has a javascript-library attached to it, which I need
  7. I found a solution: SVGimage.html <?phpsession_start();$FirstName = $_SESSION['GameName'][0];$LastName = $_SESSION['GameName'][1];$FullName = $FirstName . " " . $LastName;header('Content-Type: image/svg+xml');print('<?xml version="1.0" standalone="no"?>');?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <script type="text/ecmascript" xlink:href="Library.js"/> <?php echo "<rect x=\"50\" y=\"70\" rx=\"10\
  8. Hey.Yes, the server is running php, and I have used it with great success earlier, for example for retrieveing data from a database.I tried your suggestion to view source (good tip btw), and no php-code is shown there.What it says there is: <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/www/clanteam.com/b/e/u/beurocity/htdocs/Gamepage/BuildCity.php</b> on line <b>8</b><br />
  9. Thanks again.So it should be like this? index.html <embed src="SVGimage.php" type="image/svg+xml" width="500" height="400" /> SVGimage.php <?php session_start(); $FirstName = $_SESSION['GameName'][0]; $LastName = $_SESSION['GameName'][1]; $FullName = $FirstName . " " . $LastName; header('Content-Type: image/svg+xml');?><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <
  10. Thank you so must for answering. I tried your advice.In index.html I write the embedding with a php-extension, like this: <embed src="SVGimage.php" type="image/svg+xml" width="500" height="400" /> And my SVGimage.php looks like this: <?php session_start(); $FirstName = $_SESSION['GameName'][0]; $LastName = $_SESSION['GameName'][1]; $FullName = $FirstName . " " . $LastName; header('Content-Type: image/svg+xml');?><?xml version="1.0" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <script t
  11. I have included a SVG-file into the html-page with the embed-tag, like this: index.html <!DOCTYPE html><html><head> <script type="text/javascript" src="jquery-1.7.1.js"/> function AJAX(){ $.post("UpdatePage.php",function (PhpParameter){ $("#SVGfile").html(PhpParameter); });} </head> <body> <div style="height:50px;width:50px;background-color:black;" onclick="AJAX()"/> <embed src="SVGimage.svg" type="image/svg+xml" /></body></html> The SVG-file looks like this: SVGimage.svg <?xml version="1.0" standalone="no"?&g
  12. Hello again. I found a pretty well working solution to the problem by using the onclick-event: <html><head><script type="text/javascript" src="jquery-1.7.1.js" /> /* Including the jQuery library */<script type="text/javascript">function AjaxFunction(AjaxParameter){$.post("UpdatePage.php", /* a POST request is sent to the file UpdatePage.php , */ {contentVar: AjaxParameter}, /* and the variable AjaxParamter is passed to UpdatePage.php . */function (data){ /* When complete, */$("#AjaxResponse").html(data); /* put the response in the div with id="AjaxResponse" . */});}<
  13. Hello everyone. I was wondering if some of you might help a beginner with an issue concerning AJAX with jQuery 1.7.1 and an external PHP-file. I want to have a div, which by clicking on it will work as a trigger for an ajax-request to a PHP-file.Then I want to have second div, which by clicking on it will also work as a trigger for an ajax-request, however it gets a different response from the PHP-file. In other words, the response from the PHP-file should depend on which of the two div's was actually clicked. I have done an attempt as shown below.I know that it's missing a way to give my para
  • Create New...