javascript - Combine jquery with php ajax request -
i'm having problem. i'm creating dynamic table jquery (the user insert value , creates table). in table have select tab pre-defined values coming table in database (mysql).
this code:
$(document).ready(function() { $("#submit").click(function(e) { $("#table").empty(); e.preventdefault(); if($("#numoflevels").val() >0) { var size = $("#numoflevels").val(); var str=''; str+='<table align="center" width="694" border="0" cellspacing="3" cellpadding="0">'; str+='<tr><th style="width:auto" scope="col">level </th><th width="107">score</th><th width="58">game file</th><th width="80">catalog</th><th width="93">start date</th><th width="85">end date/th></tr>'; for(var = 0; i< size ; i++) { str+='<tr><td id="stage'+i+'" style="width:auto">level '+(i+1)+'</td><td><span id="sprytextfield4"><input type="text" name="score" id="score"/>'; str+='<span class="textfieldrequiredmsg">a value required.</span></span></td>'; str+='<td><input type="file" name="gamefile" id="gamefile" /></td>'; str+='<td><select multiple="multiple" name="catloglink" id="catloglink">'; **here need enter php function** str+='</select></td>'; str+='<td><input type="text" class="date" id="datepicker" ></td>'; str+='<td><input type="text" class="date" id="datepicker2" "></td>'; //str.find('input').datepicker(); } //str+='</tr></table>'; $("#table").append(str); var btn = ''; btn+='<tr><td width="192" colspan="2" align="center"><input type="submit" name="submit" id="submit" value="submit"/></td>'; btn+='<td width="309" colspan="4" align="center"><input type="reset" name="reset" id="clear" value="clear" /></td></tr></tr></table>'; $("#table tr:last").after(btn); } $(".date").click(function() { $( ".date" ).datepicker(); $( ".date" ).datepicker(); }); }); });
and question how php code generates option list integarte javascript code.
- my php function retrieve values (names) don't send function data.
regards, yotam.
Comments
Post a Comment