1

I have issue with an iframe when loading the contents received as AJAX GET response. Let me explain my issue in details:

The Ajax request process well and get response data very fine, but when i load the contents in iframe inside fancybox i get Following issue in browser.

The requested URL /new/<div id="wrapper"><div id="header"><div class="top_gradient"></div> <div class="topInfo-inner floatLeft"> <div class="topTitleSmall floatLeft" id="packetdeals"> <input type="button" name="snelzoeken" id="button" class="btn btn-success" value="Packet Deals" /> </div> <div class="topTitleSmall" id="exchangeRates"><div class="floatLeft"> <input type="button" name="snelzoeken" id="button" class="btn btn-success" value="Room Types" /> </div> </div> <div class="language"> <ul class="language-flags"> <li><img hspace="3" border="0" title="Nederlands" alt="Nederland" src="img/flag_nl_small.png"></li> <li><img hspace="3" border="0" title="Dutch" alt="Dutch" src="img/flag_du_small.png"></li> <li><img hspace="3" border="0" title="English" alt="English" src="img/flag_en_small.png"></li> <li><img hspace="3" border="0" title="French" alt="French" src="img/flag_fr_small.png"></li> </ul> </div> </div> <div class="floatLeft" id="dateSelection"> <div class="search-wrapper"> <div class="search"> <ul> <li> <div> <a href=" was not found on this server.

Following is the code I'm using for request and to get the response inside iframe fancybox.

$.fancybox.showLoading();

$.ajax({
  type: "POST",
  cache: false,
  async:false,
 url: url, // preview.php
  data: $('#'+frmname).serializeArray(), // all form fields
  success: function (data, textStatus, request) {

    // on success, post (preview) returned data in fancybox
    $.fancybox(data, {
      // fancybox API options
      fitToView: false,
     type:'iframe',
      autoSize: false,
      closeClick: false,
      openEffect: 'none',
      closeEffect: 'none'
    }); // fancybox
  } // success
});
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • What is the value of the url field (print it using `alert(url)` ) – Patrick Hofman Feb 05 '14 at 07:36
  • Thanks for reply...its absolute path to the server... i can provide you the url where the code is running. – user3273824 Feb 05 '14 at 12:21
  • If possible, please create a jsfiddle (jsfiddle.net). It helps us analyzing your problem. – Patrick Hofman Feb 05 '14 at 12:23
  • The content should be either `ajax` or `iframe` but not both **unless** you previously build the `iframe` within the script and place the response inside of it. If the second, check http://stackoverflow.com/a/11739627/1055987, specially the second jsfiddle. BTW, why do you want to open the response using `iframe` type? – JFK Feb 05 '14 at 18:21
  • Thanks JFK for reply... i have changed the design flow to work with only iframe. – user3273824 Feb 06 '14 at 10:17

0 Answers0