I want to show data from database into ajax.
function Data_Table() {
$.ajax( {
url: "<?php echo site_url('admin-spot/company/FieldTable')?>", type: "GET", dataType: "JSON", success: function(data) {
$('#map').dataSrc(data.map);
}
}
);
}
<iframe id="map" src="" frameborder="0" style="width: 100%; height: 300px;" allowfullscreen></iframe>
</div>
As far as i understand from your hard to judge description and the comments section, you are trying to set the src
attribute of the iframe
with the googlemap link in the ajax success
function and the src
is coming from server-side, if this is it you have to use .prop
to assign the src which should be a URL
change your function to the following
function Data_Table() {
$.ajax({
url: "<?php echo site_url('admin-spot/company/FieldTable')?>",
type: "GET",
dataType: "JSON",
success: function (data) {
$('#map').prop('src',
data.map
);
}
});
}
You can use .load() method here the jquery API jquery API
Use simple
$("#result").load("ajax/test.html");
or with a callback
$("#result").load("ajax/test.html", function() {
alert( "Load was performed." );
});