1

I have a web server that returns a svg. working perfectly. I am trying to use JQUERY to not type in browser always the request. But i dont know to load the response into a DIV.

  $.get("http://localhost/proiect/domr.php", { url:           "http://www.info.uaic.ro",type:"svg",hox:"html" },"xml" )
   .done(function(data) {
      alert("Data Loaded: " + data);
      $("#tree").html(data); 

I sais data loaded object document. And in my div with id=tree puts nothing. How can i put my data where my svg is stored in my div.

4

3 回答 3

0
$.get("http://localhost/proiect/domr.php", { url:              "http://www.info.uaic.ro",type:"svg",hox:"html" },"xml" )
.done(function(data) {
  alert("Data Loaded: " + data);
  $("#tree").append(data);

.append() should be used instead of .html().

于 2013-06-08T08:10:27.597 回答
0
<textarea id='string' style='display:none;'>dd</textarea>
<script>
var string = $('#string').val();
var datastring = 'string' = string;
$.ajax{(
url:"http://www.info.uaic.ro";
type: "POST";
cache:false;
data:datastring;
success: function(html){
$("#tree").append(html);
}
});
</script>
于 2013-06-08T08:18:24.483 回答
0

以下代码对我有用(注意 #svg 是一个 div):

$.ajax
  url: "myurl"
  type: "POST"
  complete: (data) =>
    $("#svg").append data.responseText
于 2013-09-18T23:21:53.827 回答