0

I use jQuery and ajax for REST API call and set the response to iframe. The target url returns html. It was successful but iframe shows plain page without any text formatting and other functionality. I have attached the images of actual and expected page result (part of page).

Do you how what is wrong with my code? I'm open for any suggestions or if you have better approach to get my expected result.

expected page image

actual page image

Below are my codes:

function loadPage()
{     
  $.ajax({
        url: 'URL',
        type: 'GET',
        headers: {
            'Authorization': 'Basic 123eewd45'
        },
        xhrFields: {
            withCredentials: false
        },
        dataType: 'html',
        success: function(data) {
            $('#myiframe').contents().find('html').html(data);
        }
    });
} 

Iframe:

 <iframe onload="loadPage()"
        id="myiframe">
</iframe>

Thank you!

Mykhel
  • 1
  • 1

1 Answers1

0

i think your css missing on that page please check that link u r style sheet (css) on that page

kealaxshan
  • 338
  • 2
  • 14