foxsk8 Posted June 1, 2008 Report Share Posted June 1, 2008 Tātad iesāku skatīties šo: http://demos.mootools.net/Ajax Tātad viss itkā izdevās, bet kā viņam varētu pielikt klāt lai ik pēc piem 1 min atkal notiek ielāde. <script type="text/javascript"> window.addEvent('domready', function() { $('start').addEvent('click', function(e) { e = new Event(e).stop(); var url = "zina.php"; /** * The simple way for an Ajax request, use onRequest/onComplete/onFailure * to do add your own Ajax depended code. */ new Ajax(url, { method: 'get', update: $('log') }).request(); }); }); </script> Link to comment Share on other sites More sharing options...
Kavacky Posted June 1, 2008 Report Share Posted June 1, 2008 setTimeout() neder? Btw, nezinu, kā MooTools, bet Prototype, piemēram, ir jauks "Ajax.PeriodicalUpdater". Link to comment Share on other sites More sharing options...
foxsk8 Posted June 1, 2008 Author Report Share Posted June 1, 2008 (edited) Prototype neder, jo nezinu, kas viņam tur ir, bet kad ielādē palielāku datu apjomu un uzliek uz periodical, viņš totāli visu procesu iebremzē, vismaz uz FF tā ir. Tad nu ja kādam interesē, tad iekš mootools var šādi: <script language="javascript"> function auto(url) { var ajax = new Ajax(url, { method: 'get', evalScripts : true, update : $('log') }); ajax.request(); } window.addEvent ('domready',function (){ auto.periodical(2000, this, 'zina.php'); }); </script> Vēl viens jautājums, kāds būtu ideālais datu apjoms kuru pieprasīt. Jo vienkārši ja ielādēju kaut ko lielu, tad viss pārējāis nedaudz ieraustās uz doto brīdi kad lapā tiek pieprasīta informācija. Edited June 1, 2008 by foxsk8 Link to comment Share on other sites More sharing options...
bubu Posted June 1, 2008 Report Share Posted June 1, 2008 Vai tik tu tos datus nelādē sinhroni? Vajag asinhroni lādēt - tad nekādai iebremzēšanai nevajadzētu būt (ja nu vienīgi pie saņemšanas tu gribēsi lielu/ilgu datu apstrādi veikt). Link to comment Share on other sites More sharing options...
foxsk8 Posted June 1, 2008 Author Report Share Posted June 1, 2008 Kā izpaužās tā sinhronā un asinhronā lādēšana? Vai tad var tam scriptam norādīt kādā veidā man lādēt? Šo jau biju kaut kur dzirdējis. Link to comment Share on other sites More sharing options...
bubu Posted June 1, 2008 Report Share Posted June 1, 2008 hvz, es mootools nezinu. Māku tikai jQuery. RTFM metode nelīdz? Link to comment Share on other sites More sharing options...
foxsk8 Posted June 1, 2008 Author Report Share Posted June 1, 2008 Varbūt vari ar to jQuery iedot kādu līdzīgu piemēru, notestēšu, jāskatās, kurš būtu labākais variants. Link to comment Share on other sites More sharing options...
bubu Posted June 1, 2008 Report Share Posted June 1, 2008 Kamoon... RTFM: http://docs.jquery.com/Ajax/jQuery.ajax#toptions async Boolean Default: trueBy default, all requests are sent asynchronous (e.g. this is set to true by default). If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. Link to comment Share on other sites More sharing options...
foxsk8 Posted June 1, 2008 Author Report Share Posted June 1, 2008 Tagad rādās problēmas ar to manu kodu. Gribu pievienot vēl vienu auto update, bet nesanāk. Viņš visu laiku vienā divā info maina. Varbūt kāds var palīdzēt? Link to comment Share on other sites More sharing options...
777 Posted June 3, 2008 Report Share Posted June 3, 2008 <script type="text/javascript"> window.addEvent('domready', function() { $('start').addEvent('click', function(e) { e = new Event(e).stop(); var url = "zina.php"; /** * The simple way for an Ajax request, use onRequest/onComplete/onFailure * to do add your own Ajax depended code. */ new Ajax(url, { method: 'get', update: $('log') }).request(); }); }); </script> $('log') un $('start') nozime id kur visu parada, nomaini tos uztaisi jaunu eventu un laid Link to comment Share on other sites More sharing options...
777 Posted June 3, 2008 Report Share Posted June 3, 2008 notesteju tavu kodu, un man kaut kaadigi nesanak, visu laiku izmet 404.gif Link to comment Share on other sites More sharing options...
foxsk8 Posted June 3, 2008 Author Report Share Posted June 3, 2008 (edited) Nu tur jau pats par sevi saprotmas, ka vajag arī mootools.js failu, kā arī tas viss ir jādarbina uz serveri, savādāk nejies. Atkodu kā arī var vairākus ajax rekvestus uz periodical izveidot. Edited June 3, 2008 by foxsk8 Link to comment Share on other sites More sharing options...
777 Posted June 3, 2008 Report Share Posted June 3, 2008 tu uzskati mani par stulbeni ? es tak megina ar mootools.js un saliku divu kura attelos visu ... ta vai ta vins man rada 404.gif .... Link to comment Share on other sites More sharing options...
foxsk8 Posted June 3, 2008 Author Report Share Posted June 3, 2008 Tu divu div id log nosauci tā kā? Pag, būs brīvāks laiks, iemetīšu visu piemēru, gan ar click, gan ar periodical Link to comment Share on other sites More sharing options...
777 Posted June 3, 2008 Report Share Posted June 3, 2008 es izdzesu add.event $('start') un uztaisiju <body onload="Ajax();auto()"> tacu jebkura gadijuma, es testeju vairakkaart ... man radija 404.gif, paskatijos .js nekur tada nav, nezinu no kurienes nemas vins Link to comment Share on other sites More sharing options...
Recommended Posts