2014-12-19 07:52



enter image description here

On entering the customer name in textbox it searches for customer info. I have generated successfully using JQuery by passing the entire table through Json variable, as I dont want any page refresh. Now I want to select the customer id generated from mysql db (php) through radio button, but the radio button event is not working. For testing purpose I have put a static table having the same radio button properties in that particular div(place for dynamic record generation using JQuery) and working fine. Hence I found that the data received through JQuery got some problem. Hope I am clear. Please find a way. Thanks in advance.

below is the code


<input type="text" placeholder="full name" id="fullName" name="fullName" class="txt" style="width: 250px" />&ensp;
<input type="button" id="btSelect" value="Select" class="button-crystal" />
<div id="disp"></div>


$('#btSelect').click(function () {
        var form_data = {
            genCustDetails: $('#fullName').val(),
            is_ajax: 1

            type: "POST",
            url: "xyz.php",
            data: form_data,
            dataType: "json",
            success: function (response)
        return false;        


if (isset($_POST['genCustDetails'])) {
    $result = mysql_query("select * from dbcustdetails where name like '$_POST[genCustDetails]%'");
    while ($row = mysql_fetch_assoc($result)) {
        <table style="background-color:#eee; margin-bottom:5px;">
                <th class="td3">Customer ID</th>
                <td class="td4">
                    '.$row["custID"].'&ensp;<input type="radio" id="cust_ID" name="cust_ID" value="'.$row["custID"].'" />
                <th class="td3">Name</th>
                <td class="td4">'.$row["name"].'</td>
                <th class="td3">Phone No.</th>
                <td class="td4">'.$row["phno"].'</td>
                <th class="td3">Email</th>
                <td class="td4">'.$row["email"].'</td>
                <td colspan="2" style="padding:0;">
    echo json_encode($out);
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongshai1944 dongshai1944 7年前

    Maybe You should'nt bind the event properly for the dynamic elements in the DOM.

    Try Like this

    点赞 评论 复制链接分享
  • dounao1856 dounao1856 7年前

    that is because your newly generated radio button is not having any event handler assigned to it.

    you have to assign an event handler after the ajax call (on ajax success). something like

        //Your handler code
    点赞 评论 复制链接分享