Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Firefox, onClick, ajax

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side
View previous topic :: View next topic  
Author Message
maXimus



Joined: 05 Dec 2005
Posts: 55
Location: Zagreb

PostPosted: 16.05.2007 11:51    Post subject: Firefox, onClick, ajax Add user to your forum ignore list Reply with quote

Imam ovakvu formu:
Code:
<form name="ul" method="post" action="" enctype="multipart/form-data" >
<input type="file" size="64" name="filecontent">
<input name="ubaci" type="hidden" id="ubaci" >
<input onClick="process('posalji_nesto')" type="submit" name="u" value="Submit">
</form>


JavaScript je klasično spajanje na server i preko GET-a poziva se php skripta. Koja vraća neki tekst, ništa komplicirano. A onda JavaScript ubacuje value u id forme "ubaci".

ovako izgleda dio koda u JavaScriptu za handlanje odgovora
Code:
function handleServerResponse(){
   if(xmlHttp.readyState == 4) {
      if(xmlHttp.status == 200) {
         xmlResponse = xmlHttp.responseXML;
         xmlDocumentElement = xmlResponse.documentElement;
         ubaci = xmlDocumentElement.firstChild.data;
         document.getElementById("password1").value = ubaci;
         setTimeout('process()', 1000);
      } else {
         alert("Greska kod pristupa serveru!");
      }
   }
}


I stvar super funkcionira kod Opere i IE, no kod firefoxa ne radi, jer jednostavno ne uspije dobit dobar response. Zapravo sve se sruši na liniji if(xmlHttp.status == 200). Firebug javi grešku:
Code:
[Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://nesto.com/obrada.js :: handleServerResponse :: line 50" data: no]
[Break on this error] if(xmlHttp.status == 200) {


A kad zamjenim u formi onClick sa onMouseOver stvar radi.
Da li netko zna odgovor zašto neće radit sa onClick na firefoxu
Back to top
View user's profile Send private message
r3dsc0rpi0n



Joined: 20 Apr 2005
Posts: 354
Location: Zagreb

PostPosted: 16.05.2007 12:24    Post subject: Add user to your forum ignore list Reply with quote

Probaj na formu stavit onsubmit.

_________________
::: Fortis est, qui se vincit ! ::::
Back to top
View user's profile Send private message Send e-mail Visit poster's website Twitter profile
maXimus



Joined: 05 Dec 2005
Posts: 55
Location: Zagreb

PostPosted: 16.05.2007 13:06    Post subject: Add user to your forum ignore list Reply with quote

onda se pogotovo ništa ne događa, probao sam

u biti nisam sve napisao, dakle u formi pod atribut action treba ići neka stranica za obradu forme, e sad ako bi stavio onSubmit odmah bi se sadržaj forme predao stranici za obradu i onda JavaScript ne stigne umetnut sadržaj, tako ispada

kod onClick stvar uspjeva kod Opere i IE, možda oni prije stignu dohvatit podatak i umetnut ga u formu prije nego što se pošalje
Back to top
View user's profile Send private message
snyder



Joined: 21 Dec 2005
Posts: 57
Location: Zagreb

PostPosted: 16.05.2007 13:21    Post subject: Add user to your forum ignore list Reply with quote

nakon koda u onsubmit stavi return false; pa ti se forma nece submitat na action stranicu a sve prije return false ce ti se izvrsit
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
maXimus



Joined: 05 Dec 2005
Posts: 55
Location: Zagreb

PostPosted: 16.05.2007 13:31    Post subject: Add user to your forum ignore list Reply with quote

nisam baš skužio, gdje trebam return stavit

ja želim da mi se forma pošalje, i ja ne obrađujem sadržaj forme sa javascriptom već sa php-om
Back to top
View user's profile Send private message
Moebius



Joined: 26 Jan 2004
Posts: 245
Location: zagreb

PostPosted: 16.05.2007 13:39    Post subject: Add user to your forum ignore list Reply with quote

Quote:
nisam baš skužio, gdje trebam return stavit

ja želim da mi se forma pošalje, i ja ne obrađujem sadržaj forme sa javascriptom već sa php-om


Code:
<form action="nesto" name="ime" onsubmit="javascript:nekiPoziv(); return false; ">

Tako nekako cini mi se.
Back to top
View user's profile Send private message Visit poster's website
maXimus



Joined: 05 Dec 2005
Posts: 55
Location: Zagreb

PostPosted: 16.05.2007 13:48    Post subject: Add user to your forum ignore list Reply with quote

da to sam i ja tako skužio pa je rezultat isti, tj. nevidim kako bi taj return false mogao pomoć da se stranica ne submita prije nego što ta neka funkcija obavi to što treba
Back to top
View user's profile Send private message
Moebius



Joined: 26 Jan 2004
Posts: 245
Location: zagreb

PostPosted: 16.05.2007 14:59    Post subject: Add user to your forum ignore list Reply with quote

Quote:
tj. nevidim kako bi taj return false mogao pomoć

oce pomoc. sigurno,
probaj si instalirati FireBug ekstenziju za FireFox https://addons.mozilla.org/en-US/firefox/addon/1843) ako koristis FF, moze ti dati dobar uvid u evente koji se izvrsavaju na razini JavaScript-a, moglo bi ti pomoci i u tvom konkretnom problemu.
Back to top
View user's profile Send private message Visit poster's website
maXimus



Joined: 05 Dec 2005
Posts: 55
Location: Zagreb

PostPosted: 16.05.2007 23:18    Post subject: Add user to your forum ignore list Reply with quote

koristim firebug i napisao što je javio u prvom postu, lol

uglavnom stvar je riješena uz pomoć snyder na MSN-u, hvala svima na prijedlozima
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 18.05.2007 00:40    Post subject: Add user to your forum ignore list Reply with quote

neznam kako bi ti funkcija handleResponse trebala znati sto je varijabla xmlHttp.

vjerojatno (barem uobicajeno) ta funkcija izgleda ovako
Code:
function handleServerResponse(xmlHttp){
   if(xmlHttp.readyState == 4) {
...

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
maXimus



Joined: 05 Dec 2005
Posts: 55
Location: Zagreb

PostPosted: 18.05.2007 01:19    Post subject: Add user to your forum ignore list Reply with quote

zna jer je globalna varijabla

da je to problem bio nebi radilo niti u jednom browseru
Back to top
View user's profile Send private message
sinke



Joined: 02 Oct 2005
Posts: 257
Location: Zagreb

PostPosted: 21.05.2007 19:00    Post subject: Add user to your forum ignore list Reply with quote

Po 100ti put: Ajax ne radi u FireFoxu! Wink

_________________
THE SHTANZIG | Web Do's & Don'ts
Back to top
View user's profile Send private message Visit poster's website Twitter profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group