jquery - Change iFrame src on ajax complete -


using jquery's $.ajax() want retrieve information server, , then, based on info, change src attribute of iframe.

something like:

$.ajax(                 {                     url: "someurl.aspx/getinfo",                     datatype: "json",                     data: "{'data':{'data1':'data1'}}",                     type: "post",                     contenttype: "application/json; charset=utf-8",                     complete: function(data, stat) {                         if (stat == "success" )                          {                            var src = json.parse(jsondata.responsetext).d.src                            $('#myframe').attr("src",src);                         }                       }                 }                 ); 

the page trying load returning pdf file, goal show user dialog choose between downloading or opening file. on ie7 , 8 browser showing info bar message : "to protect security, internet explorer blocked site downloading files computer. click here options."

changing iframe's src attribute outside ajax call works fine , dialog choose between opening or saving pdf shown.

any workarounds avoid info bar showing? in advance.

an alternate approach avoids both iframe , info bar not open pdf automatically. in call ajax callback, create regular link pdf file user can click on directly. should prevent ie flagging download.


Comments

Popular posts from this blog

how to build hyperlink for query string in php -

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

queue - mq_receive: message too long -