0
I’m trying to accomplish a .append();
of a iframe which is stored in comic books.
Well, this done and accomplished as follows:
$(document).ready(function(){
$.get('/viatge/auth/getStreetViewCode&${_csrf.parameterName}=${_csrf.token}',{destinationID: $('#destinationID').val()}, function(data){
$('#street-view-div').append(data);
});
});
The callback will return me the iframe complete! Just "appendar" below the div ("street-view-div"
).
There is an additional detail in my question. Such iframe will be populated within a plugin of "step-by-step", soon I also tried to accomplish in the following way:
$(document).on('ready', '#street-view-div', function(){
$.get('/viatge/auth/getStreetViewCode&${_csrf.parameterName}=${_csrf.token}',{destinationID: $('#destinationID').val()}, function(data){
$('#street-view-div').append(data);
});
});
The above form is obsolete since the jQuery 1.8 If memory serves, then it didn’t work.
Someone would have a solution even if it was palliative for my case?
EDITION
As suggested by colleague André Ribeiro when the user informs the iframe I will "debunk it" in order to store only the attributes that are suitable to work with.
Well, I did a test that was next. I left a static frame in the code as below:
<iframe width="560" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="${destinationModify.streetView.embedCode}">
</iframe>
Where the src attribute will be populated via java parameter. But the result was not quite as expected as shown below:
It simply didn’t load the contents of the frame correctly! Since in GIFT is formed correctly!
<iframe width="560" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?layer=c&panoid=WritgJx7SbMAAAQJOIX2NA&ie=UTF8&source=embed&output=svembed&cbp=13%2C178.0005991462331%2C%2C0%2C4.175384831223795"></iframe>
Already through jQuery happens it makes the request of the attribute src via AJAX and arrow the attribute, but as the image below shows no result:
What exactly doesn’t work? Wouldn’t it be more interesting if you already have this iframe in the code and only update its src, for example?
– André Ribeiro
André Ribeiro, simply iframe is not loaded! Unfortunately I will need the entire iframe as the iframe attributes will vary depending on the case.
– João Manolo
Just as you can update src you can return the new attributes and set them in the code.
– André Ribeiro
Well I’m thinking it’s gonna have to be this way, because with the whole frame it won’t! When persisting the frame I will "demystify" the main attributes to store on disk and render with AJAX callback. I’ll test and bring the feedback
– João Manolo
Hi André, sorry for the delay, but I performed the test only by changing the src via Java parameter and it didn’t work. I edited the question for better understanding.
– João Manolo