thesnarkie Posted November 25, 2009 Report Share Posted November 25, 2009 $(document).ready(function() { $("#add_comment").submit(function(){ $("#submit_comment").hide(); $(".ajax_loading").show(); var str = $(this).serialize(); $.post("/p_gamma/news/index.php?action=comment", str, function(msg){ $("#ncomment_response").ajaxComplete(function(event, request, settings){ $("#submit_comment").show(); $(".ajax_loading").hide(); if(msg == "OK") { loadContents("#news_comments_r", "/p_gamma/news/index.php?action=read_comments&news_id=1"); } else { var login_response = msg; $("#ncomment_response").html(login_response); } }); }); return false; }); }); loadContents("#news_comments_r", "/p_gamma/news/index.php?action=read_comments&news_id=1"); Viņš atkārto viņu patstāvīgi. Kā, lai skriptam liek palaist to (loadContents) funkciju tikai vienreiz? Quote Link to comment Share on other sites More sharing options...
indoom Posted November 25, 2009 Report Share Posted November 25, 2009 noņemot .ajaxComplete, kas domāts kā globālais ajax parametrs, kas palaižas katreiz, kad kāds ajax tiek pabeigts http://docs.jquery.com/Ajax/ajaxComplete Quote Link to comment Share on other sites More sharing options...
thesnarkie Posted November 26, 2009 Author Report Share Posted November 26, 2009 Ok, sanāca, bet kā var no serializētajiem datiem paņemt kādu no tiem datiem, lai varētu izmantot tajā loadContents ? Nu, piemēram, serializētie dati ir glglg=445&sl=4455&fff=2345345. Tad kā es varu paņemt sl datus, lai izmantotu skriptā: loadContents("#news_comments_r", "/p_gamma/news/index.php?action=read_comments&news_id=1"); tā 1-ninieka vietā. Quote Link to comment Share on other sites More sharing options...
indoom Posted November 26, 2009 Report Share Posted November 26, 2009 (edited) Ņem pa taisno no formas lauka vajadzīgo. Edited November 26, 2009 by indoom Quote Link to comment Share on other sites More sharing options...
thesnarkie Posted November 26, 2009 Author Report Share Posted November 26, 2009 pateiksi kā? es vēl js/ajax/jquery ne īpaši orientējos, bet jāmācās ir. :) Quote Link to comment Share on other sites More sharing options...
indoom Posted November 26, 2009 Report Share Posted November 26, 2009 ja pieņem, ka formas id = "add_comment", tad loadContents("#news_comments_r", "/p_gamma/news/index.php?action=read_comments&news_id=" + $("#add_comment input[name='sl']").val()); Quote Link to comment Share on other sites More sharing options...
thesnarkie Posted November 26, 2009 Author Report Share Posted November 26, 2009 Liels paldies! ;) *piefiksē, kā tas darāms* Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.