Jump to content
php.lv forumi
  • 0

Javascript funkcijas izaukšana no popup loga uz galvano lapu


Wuu

Question

No galvenās lapas tiek izsaukts pop-up logs ar aicinājumu draugiem.lv pasei. Ieslēdzas sesijas dati un logs aizverās. Bet kā lai padot ar javacriptu uz galveno logu ka autorizācijas mēģinājums ir noticis? Tb kā no popup loga iedarbināt javascript funkciju galvenajā logā?

Vai ir citi varianti?

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

function DraugiemApInit(app,usr) {
   draugiemAut = window.open('http://api.draugiem.lv/xml/?action=authorize&app=' + app + '&code=' + usr,'','location=1,status=1,scrollbars=0,resizable=0,width=530,height=400');
   var dsend = new XMLHttpRequest;
   dsend.onreadystatechange = function(){
       if (dsend.readyState == 4) {
           var dobj = (dsend.responseText);
	alert(dobj);
       }
   }
   dsend.open("GET", "http://api.draugiem.lv/xml/?action=authorize&app=" + app + "&code=" + usr, true);
   dsend.send(null);
}

 

Kas pa problēmu logu atver ,bet alert(dobj); negrib ne pa kam :(

Link to comment
Share on other sites

  • 0

Kāda velna pēc lai viņš neizpildās?

Pamēģināju šādu un nelamājas!

Varbūt draugiem.lv tas nogriezts?

function DraugiemApInit(app,usr) {
   draugiemAut = window.open('http://api.draugiem.lv/xml/?action=authorize&app=' + app + '&code=' + usr,'','location=1,status=1,scrollbars=0,resizable=0,width=530,height=400');
   var send3 = new XMLHttpRequest;
   send3.onreadystatechange = function(){
       if (send3.readyState == 4) {
           var obj3 = (send3.responseText);
	alert(obj3);
       } else {
	alert('neizpildās');
}
   }
   send3.open("GET", "http://api.draugiem.lv/xml/?action=authorize&app=" + app + "&code=" + usr, true);
   send3.send(null);
}

Link to comment
Share on other sites

  • 0

function getXmlHttpRequestObject() {

if (window.XMLHttpRequest) {

	return new XMLHttpRequest();

} else if(window.ActiveXObject) {

	return new ActiveXObject("Microsoft.XMLHTTP");

} else {

	return false;

}

}

function DraugiemApInit(app,usr) {
       var drReq = getXmlHttpRequestObject();
drReq.open("GET", "http://api.draugiem.lv/xml/?action=authorize", true);

drReq.onreadystatechange = handleReceiveDr; 

drReq.send(null);
alert('init');
}

function handleReceiveDr() {
alert('Handel');
if (drReq.readyState == 4) {
	var xmldoc = drReq.responseXML;
	var message_nodes = xmldoc.getElementsByTagName("draugiem");
	var vards = message_nodes[0].getElementsByTagName("error");
	alert(vards.value);

}
}

 

Pamēģināju šādi un nekā ,kaut arī http://api.draugiem.lv/xml/?action=authorize skaidri atbild brovseri! Wtf?

Un pats galvenais ka pat alert('init'); neieslēdzas!

Edited by Wuu
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...