I am gettting data from other php file with $.post request.
Please check the code first, here, if I click on the click here div with class "getPostData" I will get data from getData.php file. Until this file is working nicely.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.11.1.min.js'></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('.getPostData').on('click', function(e){
var xyz = $(this).closest('.dataFromThisRow').children('.inputBox');
$.post("getData.php", xyz.children('input[name="abcdxyz"]').serialize(), function(response) {
xyz.children('.showDataHere').html(response);
});
});
$('.abcd').on('click', function(e) {
alert("The text has been changed.");
});
});//]]>
</script>
</head>
<body>
<div class="dataFromThisRow">
<div class="inputBox">
<input type="text" name="abcdxyz" /><div class="getPostData">click here</div>
<div class="showDataHere"></div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
But problem start after that
Here is the PHP file I made (a sample PHP file, currently no error on the original one or sample PHP file):
<?php
if(isset($_POST['abcdxyz'])) {
$abcxxx = array ('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k');
echo '<select name="abcd" class="abcd"><option value="0" selected="selected">Select An Alphabet</option><optgroup label="Constant">';
foreach($abcxxx as $abcx) { echo '<option value="'.$abcx.'">'.$abcx.'</option>';}
echo '</select>';
}
?>
This php file will give you back a drop down list. What I want to do is, after getting data from the php file and showing select dropdown list, if I select (on("change)) from the list (name="abcd"), the input text (name="abcdxyz") will be disabled.
But here I tried with on change or few other commands with jQuery, but none of them are working (even the on click function which I added here, jut for sample).
Any help here?