Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

AJAX+firefox=undefined

[es] :: Javascript i AJAX :: AJAX+firefox=undefined

[ Pregleda: 4348 | Odgovora: 11 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

mojeKorIme
BiH

Član broj: 59512
Poruke: 350
*.bpro.19522235-74.bih.net.ba.



+1 Profil

icon AJAX+firefox=undefined24.07.2007. u 07:58 - pre 203 meseci
Pozdrav.. napravio sam site u ajax fazonu..sa strae imam menu, u sredini se pojavljuje sadrzaj pojedinih linkova.
Problem je u tome sto, kada kliknem na bilo koji link, u sredini se pojavi samo "undefined". To se desava u firefoxu dok je u IE sve OK. Operu nisam ni probao. Moze li mi neko pomoci
Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
 
Odgovor na temu

Ivan.Markovic

Član broj: 97763
Poruke: 330

Sajt: security-net.biz


+19 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 09:49 - pre 203 meseci
Ne "poziva" se isto AJAX biblioteka u IE i FF, pogledaj donji kod pa ce ti biti jasnije:

Code:

var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        //alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }

“If you think you are too small to make a difference, try sleeping with a mosquito.” - Dalai Lama
XIV
 
Odgovor na temu

mojeKorIme
BiH

Član broj: 59512
Poruke: 350
*.bpro.19522235-74.bih.net.ba.



+1 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 10:23 - pre 203 meseci
Kod mene je bilo ovako:
Code:
function getxmlhttp(){
var xmlhttp=false;
try {
    xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e){
    try{
        xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
        xmlhttp= false;
        }
    }
if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
xmlhttp= new XMLHttpRequest();
}
return xmlhttp;

};

Pa sam stavio da bude ovako:
Code:
function getxmlhttp(){
var xmlhttp=false;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlhttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        //alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }

//var xmlhttp=false;
//try {
//    xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
//    } catch(e){
//    try{
//        xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
//        } catch (e) {
//        xmlhttp= false;
//        }
//    }
//if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
//xmlhttp= new XMLHttpRequest();
//}
//return xmlhttp;

};

sad mi javlja sljedecu gresku u IEu.. mozda je banalno ali me ova vrucina ubi
Greska:
Code:
xmlhttp is not null or object

Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
 
Odgovor na temu

jablan

Član broj: 8286
Poruke: 4541



+710 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 10:27 - pre 203 meseci
Mani se ručnog pravljenja requesta, uzmi neku AJAX biblioteku (npr. jQuery).

Takođe treba da razmisliš da li je to (navigacija na sajtu) dobro mesto za uvođenje ajaxa. Ja mislim da nije.
 
Odgovor na temu

mojeKorIme
BiH

Član broj: 59512
Poruke: 350
*.bpro.19522235-74.bih.net.ba.



+1 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 10:48 - pre 203 meseci
Moze li mi neko reci kako da napravim funkciju koja radi ovaj request..
poslao sam vam funkciju koja radi za IE..ako ima neko neku koja radi za Firefox i operu

Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
 
Odgovor na temu

3emyh
Vladimir Aleksić
Zemun

Član broj: 6755
Poruke: 48
*.dynamic.sbb.co.yu.

Sajt: tesla.rcub.bg.ac.yu/~valt..


+2 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 10:52 - pre 203 meseci
Ovo drugo radi (IE6, FF2), kad zatvorim telo f-je. Glupo pitanje, na početku je xmlhttp dodeljeno false, f-ja ne vraća ništa, osim kad ne uspe da kreira XMLHttpRq, a onda vraća opet false. Lepo vratiš na kraju xmlhttp.
Skini firebug extenziju za FF, moćićeš da vidiš kako izgleda XMLHttpRq objekat, imaš JS debugger, vide se zahtevi serveru, kao i odgovor.
Uzgred, postoji li slična alatka za IE, meni je super da razvijam stranicu na FF, ali je ponekad muka prebaciti je pod IE?
 
Odgovor na temu

mojeKorIme
BiH

Član broj: 59512
Poruke: 350
*.bpro.19522235-74.bih.net.ba.



+1 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 12:18 - pre 203 meseci
ovo kod mene nikako ne radi..
ako nesto promjenim onda mi i u IEu javlja undefined kao i u firefoxu

ima li neko neki primjer koji radi za obadva browsera
Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
 
Odgovor na temu

Ivan.Markovic

Član broj: 97763
Poruke: 330

Sajt: security-net.biz


+19 Profil

icon Re: AJAX+firefox=undefined24.07.2007. u 16:23 - pre 203 meseci
Ovo mora da radi:

Code:

if(window.XMLHttpRequest) {
    
    AjaxRequest = new XMLHttpRequest();

} else if(window.ActiveXObject) {
    
    AjaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    
    if (!AjaxRequest) {
        AjaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
}



?
“If you think you are too small to make a difference, try sleeping with a mosquito.” - Dalai Lama
XIV
 
Odgovor na temu

mojeKorIme
BiH

Član broj: 59512
Poruke: 350
*.bpro.19522235-74.bih.net.ba.



+1 Profil

icon Re: AJAX+firefox=undefined25.07.2007. u 10:51 - pre 203 meseci
Ovo radi za IE ali ne i za firefox i operu..radi ali pise undefined..
ovaj prijasnji prijedlog ne radi za IE..pise undefined.
Code:
function getxmlhttp(){
var xmlhttp=false;
try {
    xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e){
    try{
        xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
        xmlhttp= false;
        }
    }
if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
xmlhttp= new XMLHttpRequest();
}
return xmlhttp;

};

function processajax(obj,serverPage){
var theimg;
var lok="<div class=\"poruka\"><img src=\"slike/indikator.gif\" width=\"70\" height=\"10\" /><br>Ucitava se...........</div>";

var xmlhttp=getxmlhttp();
xmlhttp.open("GET",serverPage+"&ssid="+Math.random(),true);
document.getElementById(obj).innerHTML=lok;
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && (xmlhttp.status==200 || xmlhttp.status == 304)){
    document.getElementById(obj).innerHTML=xmlhttp.responsetext;
    //alert(xmlhttp.responsetext);
    }
}
xmlhttp.send(null);
};

Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
 
Odgovor na temu

Br@nkoR
http://localhost

Član broj: 2597
Poruke: 1603

Sajt: localhost


+23 Profil

icon Re: AJAX+firefox=undefined26.07.2007. u 11:33 - pre 203 meseci
Umesto:
Code:
xmlhttp.responsetext

stavi:
Code:
xmlhttp.responseText

Banned - Not available
 
Odgovor na temu

mojeKorIme
BiH

Član broj: 59512
Poruke: 350
*.bpro.19522235-74.bih.net.ba.



+1 Profil

icon Re: AJAX+firefox=undefined27.07.2007. u 09:41 - pre 202 meseci
wow super... ovo radi...
imam samo jos jedan problemcic..
na desnoj strani sitea imam video...
Code:
<div id="video1" class="video1">
<object width="250" height="205">
<param name="movie" value="http://www.youtube.com/v/F7JYfABJMd4">
</param>
<embed src="http://www.youtube.com/v/F7JYfABJMd4" type="application/x-shockwave-flash" width="250" height="205">
</embed>
</object>
</div>
&nbsp;&nbsp;
<a href="#" onclick="idiv(1)"><img src="slike/kamera.gif" alt="pogledaj" width="15" height="11" border="0" />&nbsp;&nbsp Posjeta</a><br>
&nbsp;&nbsp;
<a href="#" onclick="idiv(2)"><img src="slike/kamera.gif" alt="pogledaj" width="15" height="11" border="0" />&nbsp;&nbsp SURADNJA </a><br>
&nbsp;&nbsp;
<a href="#" onclick="idiv(3)"><img src="slike/kamera.gif" alt="pogledaj" width="15" height="11" border="0" />&nbsp;&nbsp Sjednica </a><br>

napravio sam idiv() funkciju
Code:
function idiv(idd){
var lokacija= "video.php?pic="+idd;
//alert(id);
processajax("video1",lokacija);
};
processajax gunkcij sam vec postavio...
Problem je u tome sto se vdeo na klik linkova prikazuje i u IE7 i firefox ..ali kada probam u IE6 nece.. ne znam zbog cega..
video.php je:
Code:
<? 
$pic=$_GET["pic"]; 
//echo $pic;
if ($pic=='1') echo "<object width=\"250\" height=\"205\"><param name=\"movie\" value=\"http://www.youtube.com/v/2vlysi-W_lM\"> </param><embed src=\"http://www.youtube.com/v/2vlysi-W_lM\" type=\"application/x-shockwave-flash\" width=\"250\" height=\"205\"> </embed> </object>"; 
else if ($pic=='2') echo "<object width=\"250\" height=\"205\"><param name=\"movie\" value=\"http://www.youtube.com/v/F7JYfABJMd4\"> </param><embed src=\"http://www.youtube.com/v/F7JYfABJMd4\" type=\"application/x-shockwave-flash\" width=\"250\" height=\"205\"> </embed> </object>";
else echo "<object width=\"250\" height=\"205\"><param name=\"movie\" value=\"http://www.youtube.com/v/F7JYfABJMd4\"> </param><embed src=\"http://www.youtube.com/v/WkOU4OKxODk\" type=\"application/x-shockwave-flash\" width=\"250\" height=\"205\"> </embed> </object>";
?> 


hval jos jednom na pomoci
Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
 
Odgovor na temu

Br@nkoR
http://localhost

Član broj: 2597
Poruke: 1603

Sajt: localhost


+23 Profil

icon Re: AJAX+firefox=undefined27.07.2007. u 15:12 - pre 202 meseci
Pokušaj sa drugačijim html kôdom za puštanje videa, npr.
Code:
<object width="250" height="205" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash/cabs/swflash.cab">
  <param name="movie" value="http://www.youtube.com/v/2vlysi-W_lM" />
  <param name="quality" value="high" /> 
  <embed src="http://www.youtube.com/v/2vlysi-W_lM" type="application/x-shockwave-flash" width="250" height="205" pluginspage="http://www.macromedia.com/shoc...P1_Prod_Version=ShockwaveFlash"></embed>
</object>

Banned - Not available
 
Odgovor na temu

[es] :: Javascript i AJAX :: AJAX+firefox=undefined

[ Pregleda: 4348 | Odgovora: 11 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.