html - ajax causing to stop further actions on php page -
i have page generates tables utilizing loop. (the syntax works fine in php file, copy paste, disregard syntax errors prototype)
<form id="formid" name="formname" method="post" action=""> <input type="hidden" name="class" value="someclass"> <input type="hidden" name="section" value="somesection"> <select name="school" id="school"> $lengtharray = count($array); ($k = 0; $k < $lengtharray ; $k++) { <option> . urldecode($array[$k]) . </option>; } </select> </form>
my ajax following :
$("#school").change(function () { // resetvalues(); var data = $("#formid").serialize(); jquery.ajax({ url: 'unexisting.php', type: "post", datatype: "xml", data: data, async: false, success:function (response) { alert("data save successful"); } }); }
whenever pick school list first time (there lot in list), able call unexisting.php, once first time, below dropdown lists not function. can see schools in them , select value, doing not invoke unexisting.php file.
where going wrong ? should fix things inside onsuccess ?
check if works
<form id="formid" name="formname" method="post" action=""> <input type="hidden" name="class" value="someclass"> <input type="hidden" name="section" value="somesection"> <select name="school" class="school" id="school1"> <?php $lengtharray = count($array); ($k = 0; $k < $lengtharray ; $k++) { ?> <option value="<?php echo urldecode($array[$k]) ?>"> <?php echo urldecode($array[$k]) ?> </option> <?php } ?> </select> </form>
ajax part
var current_changed_id = ''; $(".school").change(function () { current_changed_id = $(this).attr('id'); var data = $("#formid").serialize(); jquery.ajax({ url: 'unexisting.php', type: "post", datatype: "xml", data: data, async: false, success: listonsuccess }); function listonsuccess(xmlindata) { $('#'+current_changed_id).attr("disabled", "disabled"); $('#'+current_changed_id).disabled = true; }
Comments
Post a Comment