javascript - Make a YUI asyncRequest call which is not async -
i want make yahoo.util.connect.asyncrequest call, not async. open(method, url, async) false passed async.
i can't find "syncrequest" in connect class. possible using yui 2?
i tried without yui instead:
function createrequestobject() { var ro; // mozilla, safari,... if (window.xmlhttprequest) { ro = new xmlhttprequest(); if (ro.overridemimetype) { ro.overridemimetype('text/xml'); // see note below line } // ie } else if (window.activexobject) { try { ro = new activexobject("msxml2.xmlhttp"); } catch (e) { try { ro = new activexobject("microsoft.xmlhttp"); } catch (e) {} } } if (!ro) { alert('giving :( cannot create xmlhttp instance'); return false; } return ro; } function sndreq(param,server,handler) { http = createrequestobject(); http.open('get', server+"?"+param, false); http.setrequestheader('content-type','application/x-www-form-urlencoded'); http.onreadystatechange = handler; http.send(null); }
but in firefox , safari callback function (handler) not called on 'onreadystatechange' when false passed in 'open'? in ie , opera works ok.
yui3 supports synchronous requests in "yui io" , available on development master on github. implementation syntax included in readme file, , formally documented release in 3.1.0. enhancement documented 2528181 on yuilibrary.com.
if in position use yui 3, give io try.
Comments
Post a Comment