i'm new here , ask understanding downloading script :
echo '<div id="xx">'; if ($nazwa == "1234") { $nazwa_color = "red"; } else { $nazwa_color = "black"; } echo '<div style="padding-left:0px;float:left;margin-left:1px;"><input type="text" autocomplete="off" style="font-family:tahoma;text-indent:2px;text-align:left;font-size:12px;width:500px;height:29px;background-color : white ; color : ' . $nazwa_color . ';border-width:1px;border-style:ridge;border-color:rgb(208,208,208);" name="nazwa" value="b" class="wyk_edit"></div>'; echo'</div>';
and in javascript :
$(this).parent().parent().parent().find(".xx").load("setup-wyklady/wyk_edit_proces.php #xx");
does not address condition 'if'. why?
thanks, not working. maybe show all. portion of file want replace method of load:
$wyk_query1 = mysql_query("select * nazwy_wyklady id_wykladu <> 9999 order nr") or die('błąd zapytania'); while($wyk=mysql_fetch_array($wyk_query1)){ //begin loop $id_wykladu=$wyk['id_wykladu'] ; $nr=$wyk['nr'] ; $nazwa=$wyk['nazwa'] ; echo '<form action="../wyklady/setup-wyklady/wyk_edit_proces.php" method="post"> '; echo '<div style="float:left;width:590px;margin-top:2px;background:none" >'; echo '<div style="padding-left:0px;float:left;margin-left:1px;"><input type="text" readonly="readonly" style="font-family:tahoma;text-indent:2px;text-align:center;font-size:12px;width:30px;height:29px;background-color : white ; color : black;border-width:1px;border-style:ridge;border-color:rgb(208,208,208);" name="nr" value="'.$nr.'" class="wyk_edit_nr"></div>'; if($nazwa=="1234") { $nazwa_color = "red" ; } else { $nazwa_color = "black" ; } echo '<div style="padding-left:0px;float:left;margin-left:1px;" class="xx"><input type="text" autocomplete="off" style="font-family:tahoma;text-indent:2px;text-align:left;font-size:12px;width:500px;height:29px;background-color : white ; color : '.$nazwa_color.';border-width:1px;border-style:ridge;border-color:rgb(208,208,208);" name="nazwa" value="'.$nazwa.'" class="wyk_edit"></div>'; echo '<div style="float:left;margin-left:15px;margin-top:1px;" > <input style="display:none;cursor:pointer;width:25px;height:25px;background-color:white;color:rgb(193,135,107);" id="edit_button" title="zatwierdź zmiany" value="" class="wyk_edit_button"></div>' ; echo '<input type="hidden" name="id_wykladu" value="'.$id_wykladu.' " class="wyk_edit_id"> '; echo '</div>'; // 2a echo '</form> '; } //end of loop
and script loads (wyk_edit_proces.php):
$wyk_query1 = mysql_query("select * nazwy_wyklady id_wykladu ='$id_wykladu1'") or die('błąd zapytania'); $wyk=mysql_fetch_array($wyk_query1) ; $id_wykladu=$wyk['id_wykladu'] ; $nr=$wyk['nr'] ; $nazwa=$wyk['nazwa'] ; echo '<form action="../wyklady/setup-wyklady/wyk_edit_proces.php" method="post"> '; echo '<div style="float:left;width:590px;margin-top:2px;background:none" >'; echo '<div style="padding-left:0px;float:left;margin-left:1px;"><input type="text" readonly="readonly" style="font-family:tahoma;text-indent:2px;text-align:center;font-size:12px;width:30px;height:29px;background-color : white ; color : black;border-width:1px;border-style:ridge;border-color:rgb(208,208,208);" name="nr" value="'.$nr1.'" class="wyk_edit_nr"></div>'; if($nazwa=="1234") { $nazwa_color = "red" ; } else { $nazwa_color = "black" ; } echo '<div style="padding-left:0px;float:left;margin-left:1px;"><input type="text" autocomplete="off" style="font-family:tahoma;text-indent:2px;text-align:left;font-size:12px;width:500px;height:29px;background-color : white ; color : '.$nazwa_color.';border-width:1px;border-style:ridge;border-color:rgb(208,208,208);" name="nazwa" value="b" class="wyk_edit"></div>'; echo '<div style="float:left;margin-left:15px;margin-top:1px;" > <input style="display:none;cursor:pointer;width:25px;height:25px;background-color:white;color:rgb(193,135,107);" id="edit_button" title="zatwierdź zmiany" value="" class="wyk_edit_button"></div>' ; echo '<input type="hidden" name="id_wykladu" value="'.$id_wykladu.' " class="wyk_edit_id"> '; echo '</div>'; echo '</form> ';
and javascript:
<script> //-----------------------------------------------------------------ajax - wykłady $(document).ready(function(){ $(".wyk_edit_button").click(function () { var id_wykladu1 = $(this).parent().parent().parent().find(".wyk_edit_id").val(); var nr1 = $(this).parent().parent().parent().find(".wyk_edit_nr").val(); var nazwa1 = $(this).parent().parent().parent().find(".wyk_edit").val().trim(); // alert(id_wykladu1 + " " + nr1 + " " + nazwa1) if(nazwa1 == "") { alert("puste"); } else { $.ajax({ type : "post", url : "setup-wyklady/wyk_edit_proces.php", data : { id_wykladu : id_wykladu1, nr : nr1, nazwa : nazwa1 }, context: this, success : function() { $(this).parent().parent().parent().find(".wyk_edit").load("setup-wyklady/wyk_edit_proces.php", function(){ alert("done"); }); if (!$(".popup:visible").length) { $(".popup").fadein(1); } }, complete : function(r) { }, error: function(error) { } }); } }); $(".popup .bg, .popup .container").click(function() { $(".popup").fadeout(250); }); }); </script>
what think async:false ?
it's because jquery .load-method works asynchronus mentioned in this article. try use invoked callback-function:
$(randomstuff).load("test",function() { alert("i'm done"); }
Comments
Post a Comment