Perform .append (); of an iframe when the page loads

0

I'm trying to make a .append(); of an iframe that is stored in DB. 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 the complete iframe ! Just by "appending" below the div ( "street-view-div" ).

There is an additional detail in my question. This will be populated within a plugin by step-by-step, so I've also tried to do it as follows:

$(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 jQuery 1.8 if my memory does not crash, it soon did not work.

Would anyone have a solution even though it would be palliative for my case?

EDITION

As suggested by colleague André Ribeiro when the user informs the iframe I will "unmask" it in order to store only the attributes that suit to work.

Well, I did a test that was as follows. 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 the java parameter. But the result was not quite as expected as shown below:

Itjustdidnotloadthecontentsoftheframecorrectly!BeinginDOMisformedcorrectly!

<iframe width="560" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?layer=c&amp;panoid=WritgJx7SbMAAAQJOIX2NA&amp;ie=UTF8&amp;source=embed&amp;output=svembed&amp;cbp=13%2C178.0005991462331%2C%2C0%2C4.175384831223795"></iframe>

    
asked by anonymous 20.02.2015 / 22:30

0 answers